fix the only file upload param
Showing
1 changed file
with
2 additions
and
2 deletions
| ... | @@ -275,7 +275,7 @@ func (b *BeegoHttpRequest) getResponse() (*http.Response, error) { | ... | @@ -275,7 +275,7 @@ func (b *BeegoHttpRequest) getResponse() (*http.Response, error) { |
| 275 | } else { | 275 | } else { |
| 276 | b.url = b.url + "?" + paramBody | 276 | b.url = b.url + "?" + paramBody |
| 277 | } | 277 | } |
| 278 | } else if b.req.Method == "POST" && b.req.Body == nil && len(paramBody) > 0 { | 278 | } else if b.req.Method == "POST" && b.req.Body == nil { |
| 279 | if len(b.files) > 0 { | 279 | if len(b.files) > 0 { |
| 280 | bodyBuf := &bytes.Buffer{} | 280 | bodyBuf := &bytes.Buffer{} |
| 281 | bodyWriter := multipart.NewWriter(bodyBuf) | 281 | bodyWriter := multipart.NewWriter(bodyBuf) |
| ... | @@ -303,7 +303,7 @@ func (b *BeegoHttpRequest) getResponse() (*http.Response, error) { | ... | @@ -303,7 +303,7 @@ func (b *BeegoHttpRequest) getResponse() (*http.Response, error) { |
| 303 | b.Header("Content-Type", contentType) | 303 | b.Header("Content-Type", contentType) |
| 304 | b.req.Body = ioutil.NopCloser(bodyBuf) | 304 | b.req.Body = ioutil.NopCloser(bodyBuf) |
| 305 | b.req.ContentLength = int64(bodyBuf.Len()) | 305 | b.req.ContentLength = int64(bodyBuf.Len()) |
| 306 | } else { | 306 | } else if len(paramBody) > 0 { |
| 307 | b.Header("Content-Type", "application/x-www-form-urlencoded") | 307 | b.Header("Content-Type", "application/x-www-form-urlencoded") |
| 308 | b.Body(paramBody) | 308 | b.Body(paramBody) |
| 309 | } | 309 | } | ... | ... |
-
Please register or sign in to post a comment