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