I am wrapping the RequestWriter as suggested by this answer
type MyResponseWriter struct {
http.ResponseWriter
buf *bytes.Buffer
}
func (mrw *MyResponseWriter) Write(p []byte) (int, error) {
return mrw.buf.Write(p)
}
However my buffer buf becomes polluted with other encoded data which could be related to the checksums/headers @icza mentions. In longer requests I get completely unreadable data, which could be related with compression. How can can you deal with this data if you want to parse it into a json for logging purposes for example?
Here are a couple of snapshots of what I get if I try to log buf.String()

