824e3f8f by astaxie

fix the only file upload param

1 parent 1822dd95
...@@ -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 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!