Browse Source

添加post参数

pull/195/head
zhangxin 3 years ago
parent
commit
257aee298e
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      utils/request.go

+ 2
- 2
utils/request.go View File

@ -27,7 +27,7 @@ func GetRequest(url string) (body []byte, err error) {
}
func PostFormDataWithSingleFile(url string, filepath string) (body []byte, err error){
func PostFormDataWithSingleFile(url string, filepath string, filename string) (body []byte, err error){
client := http.Client{}
bodyBuf := &bytes.Buffer{}
bodyWrite := multipart.NewWriter(bodyBuf)
@ -38,7 +38,7 @@ func PostFormDataWithSingleFile(url string, filepath string) (body []byte, err e
}
defer file.Close()
// file 为key
fileWrite, err := bodyWrite.CreateFormFile("file", "logData")
fileWrite, err := bodyWrite.CreateFormFile("file", filename)
if err != nil {
return nil, err
}


Loading…
Cancel
Save