Documentation ¶
Overview ¶
Package writer provides convenience wrappers around common write/print operations for our HTTP primitives.
Index ¶
- type PrintOpt
- type Writer
- func (w *Writer) PrintRequest(req *http.Request, opts ...PrintOpt) error
- func (w *Writer) PrintResponse(resp *http.Response, opts ...PrintOpt) error
- func (w *Writer) Printf(format string, a ...any) error
- func (w *Writer) PrintfBlue(format string, a ...any) error
- func (w *Writer) PrintfCyan(format string, a ...any) error
- func (w *Writer) PrintfGreen(format string, a ...any) error
- func (w *Writer) Write(p []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrintOpt ¶
type PrintOpt func(*printOpts)
A PrintOpt is an option for printing an HTTP request or response.
func WithHeaders ¶
WithHeaders specifies that the response headers should be printed.
func WithHighlight ¶
WithHighlight specifies that the request/response body should be highlighted.
func WithStream ¶
WithStream specifies that the response body should be streamed.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
A Writer wraps an io.Writer and provides convenience methods for writing data.
func (*Writer) PrintRequest ¶
PrintRequest prints information about an HTTP request.
func (*Writer) PrintResponse ¶
PrintResponse prints information about an HTTP response.
func (*Writer) PrintfBlue ¶
PrintfBlue writes a formatted string to the underlying io.Writer in blue.
func (*Writer) PrintfCyan ¶
PrintfCyan writes a formatted string to the underlying io.Writer in red.
func (*Writer) PrintfGreen ¶
PrintfGreen writes a formatted string to the underlying io.Writer in green.