On the surface httputil.DumpResponse(resp *http.Response, body bool) (byte, error) seems like a very simple function that serializes a http.Response into a byte. However, using this function correctly is harder than it seems. In fact, even the standard library’s example has a subtle bug that stems from using httputil.DumpResponse(). Let’s take a look at the example in question:
Internal error messages are usually brief and in a format that is optimized for logging and searching. An example would be: > error=true, service=phantom, txid=12345, msg="user not authorized" While that’s a great error message for developers to search by tags, its not a great error message to display to an end user.