This function causes nil request.Body to be set to non nil request.Body, but with zero length. When our handler function receives the request later, it breaks.
Create mux with a handler function after setting the nrgorilla middleware on the mux
Make a request using http.NoBody as the request.Body payload, then access the request.Body inside the handler function.
Expected Behavior
request.Body of type http.NoBody should remain nil or set to http.NoBody. it should have have empty zero length io.Reader created and set on it. Doing so breaks http handlers that check for nil / http.NoBody
Description
We use gorilla middleware, which calls
txn.SetWebRequestHTTP(r)
, which callshttps://github.com/newrelic/go-agent/blob/0e521dc894ec887e31125067f28bd3992cf33310/v3/newrelic/transaction.go#L221
This function causes nil request.Body to be set to non nil request.Body, but with zero length. When our handler function receives the request later, it breaks.
Create mux with a handler function after setting the nrgorilla middleware on the mux Make a request using http.NoBody as the request.Body payload, then access the request.Body inside the handler function.
Expected Behavior
request.Body of type http.NoBody should remain nil or set to http.NoBody. it should have have empty zero length io.Reader created and set on it. Doing so breaks http handlers that check for nil / http.NoBody
NR Diag results
Your Environment
Reproduction case
Additional context