github.com/rclone/debughttp (go): Package debughttp provides an http Transport or Client which can be used for tracing HTTP requests for debugging purposes.  This can be used for a quick bit of debugging.  Instead of using http.Get or client.Get, use this  This will log something like this  If you want to see the bodies of the transactions use this  Note that this redacts authorization headers by default.  If you want more control over what is logged and what isn't logged then you can use the Options struct, eg  If you are integrating this with code which has its own logging system then you will want to pass in the Logf parameter to control where the logs are sent.  Every Go library which does HTTP transactions on your behalf should take an http.Client or allow the setting of an http.Transport replacement. (If you find one which doesn't, then report an issue!)  To create a new Transport use the NewDefault function to base one off the default transport or the New function to base one off an existing transport.  This means that you can use this library for debugging other people's code. For example this is how you add this library to the AWS SDK  If you do this you can see exactly what requests are sent to and from AWS.  If dumping bodies is enabled the bodies are held in memory so large requests and responses can use a lot of memory.  The Accept-Encoding as shown may not be correct in the Request and the Response may not show Content-Encoding if the Go standard libraries auto gzip encoding was in effect. In this case the body of the request will be gunzipped before showing it.
Keywords: debug|golang|http