Skip to content

Commit fe9c49a

Browse files
authored
Update http.go
1 parent ede4a90 commit fe9c49a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

http/http.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ func setBody(req *http.Request, body starlark.String, formData *starlark.Dict, f
234234
return err
235235
}
236236
req.Body = ioutil.NopCloser(strings.NewReader(uq))
237+
// Specifying the Content-Length ensures that https://go.dev/src/net/http/transfer.go doesnt specify Transfer-Encoding: chunked which is not supported by some endpoints.
238+
// This is required when using ioutil.NopCloser method for the request body (see ShouldSendChunkedRequestBody() in the library mentioned above).
237239
req.ContentLength = int64(len(uq))
238240

239241
return nil

0 commit comments

Comments
 (0)