From e3d40c490423d389e09422efa50fca8861ebd7b3 Mon Sep 17 00:00:00 2001 From: Joe Presbrey Date: Wed, 29 Mar 2017 20:24:36 -0400 Subject: [PATCH] preset ContentLength in first http.Request `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. --- hey.go | 1 + 1 file changed, 1 insertion(+) diff --git a/hey.go b/hey.go index 7001d3c1..11442610 100644 --- a/hey.go +++ b/hey.go @@ -195,6 +195,7 @@ func main() { if err != nil { usageAndExit(err.Error()) } + req.ContentLength = int64(len(bodyAll)) req.Header = header if username != "" || password != "" { req.SetBasicAuth(username, password)