preset ContentLength in first http.Request (#48)

`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.
This commit is contained in:
presbrey
2017-12-19 12:13:35 -05:00
committed by mdakin
parent ed20a4b681
commit 32f75cf068

1
hey.go
View File

@@ -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)