rt

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

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.

func NewDialer

func NewDialer(upgrader Upgrader, client *http.Client, method string, url *url.URL) httpstream.Dialer

NewDialer will create a dialer that connects to the provided URL and upgrades the connection to SPDY.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL