mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-17 03:02:28 +08:00
fix: set request body content-length
This commit is contained in:
@@ -160,6 +160,7 @@ func setBodyByte(req *http.Request, body interface{}) error {
|
|||||||
switch b := body.(type) {
|
switch b := body.(type) {
|
||||||
case []byte:
|
case []byte:
|
||||||
req.Body = ioutil.NopCloser(bytes.NewReader(b))
|
req.Body = ioutil.NopCloser(bytes.NewReader(b))
|
||||||
|
req.ContentLength = int64(len(b))
|
||||||
default:
|
default:
|
||||||
return errors.New("body type should be []byte")
|
return errors.New("body type should be []byte")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user