Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDebuggingRoundTripper ¶
func NewDebuggingRoundTripper(rt http.RoundTripper, logger zerolog.Logger, levels ...DebugLevel) http.RoundTripper
NewDebuggingRoundTripper allows to display in the logs output debug information on the API requests performed by the client.
Types ¶
type DebugLevel ¶
type DebugLevel int
DebugLevel is used to enable debugging of certain HTTP requests and responses fields via the debuggingRoundTripper.
const ( // DebugJustURL will add to the debug output HTTP requests method and url. DebugJustURL DebugLevel = iota // DebugURLTiming will add to the debug output the duration of HTTP requests. DebugURLTiming // DebugCurlCommand will add to the debug output the curl command equivalent to the // HTTP request. DebugCurlCommand // DebugRequestHeaders will add to the debug output the HTTP requests headers. DebugRequestHeaders // DebugResponseStatus will add to the debug output the HTTP response status. DebugResponseStatus // DebugResponseHeaders will add to the debug output the HTTP response headers. DebugResponseHeaders // DebugDetailedTiming will add to the debug output the duration of the HTTP requests events. DebugDetailedTiming )
type Upgrader ¶
type Upgrader interface { // NewConnection validates the response and creates a new Connection. NewConnection(resp *http.Response) (httpstream.Connection, error) }
Upgrader validates a response from the server after a SPDY upgrade.
func RoundTripperFor ¶
func RoundTripperFor(debugLogger *zerolog.Logger, newStreamHandler httpstream.NewStreamHandler) (http.RoundTripper, Upgrader, error)
RoundTripperFor returns a round tripper and Upgrader to use with SPDY. If debugLogger is not nil, the returned round tripper will print debug info into it.
Click to show internal directories.
Click to hide internal directories.