mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 04:01:29 +00:00
fix the only file upload param
This commit is contained in:
parent
1822dd95ac
commit
824e3f8f5b
@ -275,7 +275,7 @@ func (b *BeegoHttpRequest) getResponse() (*http.Response, error) {
|
|||||||
} else {
|
} else {
|
||||||
b.url = b.url + "?" + paramBody
|
b.url = b.url + "?" + paramBody
|
||||||
}
|
}
|
||||||
} else if b.req.Method == "POST" && b.req.Body == nil && len(paramBody) > 0 {
|
} else if b.req.Method == "POST" && b.req.Body == nil {
|
||||||
if len(b.files) > 0 {
|
if len(b.files) > 0 {
|
||||||
bodyBuf := &bytes.Buffer{}
|
bodyBuf := &bytes.Buffer{}
|
||||||
bodyWriter := multipart.NewWriter(bodyBuf)
|
bodyWriter := multipart.NewWriter(bodyBuf)
|
||||||
@ -303,7 +303,7 @@ func (b *BeegoHttpRequest) getResponse() (*http.Response, error) {
|
|||||||
b.Header("Content-Type", contentType)
|
b.Header("Content-Type", contentType)
|
||||||
b.req.Body = ioutil.NopCloser(bodyBuf)
|
b.req.Body = ioutil.NopCloser(bodyBuf)
|
||||||
b.req.ContentLength = int64(bodyBuf.Len())
|
b.req.ContentLength = int64(bodyBuf.Len())
|
||||||
} else {
|
} else if len(paramBody) > 0 {
|
||||||
b.Header("Content-Type", "application/x-www-form-urlencoded")
|
b.Header("Content-Type", "application/x-www-form-urlencoded")
|
||||||
b.Body(paramBody)
|
b.Body(paramBody)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user