Pretty Print HTTP Requests — screenshot of github.com

Pretty Print HTTP Requests

httpretty is a Go package I use to pretty-print HTTP requests and responses directly to the terminal. It's a handy debugging tool, akin to curl --verbose, for observing HTTP traffic in Go applications.

Visit github.com →

Questions & Answers

What is httpretty?
httpretty is a Go package designed to pretty-print HTTP requests and responses from Go programs to the terminal. It provides detailed, colored output for debugging network interactions.
Who should use httpretty?
It's for Go developers who need to inspect the HTTP traffic generated by their applications, both on the client and server sides, aiding in debugging and understanding network communication.
How does httpretty compare to other Go HTTP debugging tools?
httpretty is inspired by curl --verbose and httputil.DumpRequest, offering configurable logging for request/response headers, bodies, TLS details, and colors. It differentiates by integrating directly into http.Client.Transport or http.Handler middleware for ease of use.
When is httpretty most useful?
httpretty is most useful during development and debugging phases when you need immediate, visible feedback on the exact HTTP requests and responses your Go application is sending or receiving.
How can I configure httpretty to show specific request details?
You can configure httpretty using a httpretty.Logger struct, setting fields like Time, TLS, RequestHeader, RequestBody, ResponseHeader, ResponseBody, and Colors to control what information is printed. It also supports custom formatters and filters.