Skip to content

armgit / hey

Public Imported from GitHub
0

HTTP load generator, ApacheBench (ab) replacement

Go

set body only if there is body

Jaana Burcu Dogan13f5f84458fb
diff --git a/requester/requester.go b/requester/requester.go
index 86fe61e..2053609 100644
--- a/requester/requester.go
+++ b/requester/requester.go
@@ -252,6 +252,8 @@ func cloneRequest(r *http.Request, body []byte) *http.Request {
for k, s := range r.Header {
r2.Header[k] = append([]string(nil), s...)
}
- r2.Body = ioutil.NopCloser(bytes.NewReader(body))
+ if len(body) > 0 {
+ r2.Body = ioutil.NopCloser(bytes.NewReader(body))
+ }
return r2
}