Skip to content

Commit

Permalink
preset ContentLength in first http.Request (#48)
Browse files Browse the repository at this point in the history
`http.NewRequest(url, method, body)` usually handles req.CL, but we must calculate it since body is initially passed as nil for cloneRequest to handle later on.

Fixes #36.
  • Loading branch information
presbrey authored and mdakin committed Dec 19, 2017
1 parent ed20a4b commit 32f75cf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions hey.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func main() {
if err != nil {
usageAndExit(err.Error())
}
req.ContentLength = int64(len(bodyAll))
req.Header = header
if username != "" || password != "" {
req.SetBasicAuth(username, password)
Expand Down

0 comments on commit 32f75cf

Please sign in to comment.