httputil

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBasicAuthRoundTripper

func NewBasicAuthRoundTripper(username, password string, rt http.RoundTripper) http.RoundTripper

NewBasicAuthRoundTripper will apply a BASIC auth authorization header to a request unless it has already been set.

func NewBearerAuthRoundTripper

func NewBearerAuthRoundTripper(bearer string, rt http.RoundTripper) http.RoundTripper

NewBearerAuthRoundTripper adds the provided bearer token to a request unless the authorization header has already been set.

func NewClient

func NewClient(rt http.RoundTripper) *http.Client

NewClient returns a http.Client using the specified http.RoundTripper.

func NewDeadlineClient

func NewDeadlineClient(timeout time.Duration, proxyURL *url.URL) *http.Client

NewDeadlineClient returns a new http.Client which will time out long running requests.

func NewDeadlineRoundTripper

func NewDeadlineRoundTripper(timeout time.Duration, proxyURL *url.URL) http.RoundTripper

NewDeadlineRoundTripper returns a new http.RoundTripper which will time out long running requests.

func NewTLSConfig

func NewTLSConfig(opts TLSOptions) (*tls.Config, error)

Types

type CompressionHandler

type CompressionHandler struct {
	Handler http.Handler
}

CompressionHandler is a wrapper around http.Handler which adds suitable response compression based on the client's Accept-Encoding headers.

func (CompressionHandler) ServeHTTP

func (c CompressionHandler) ServeHTTP(writer http.ResponseWriter, req *http.Request)

ServeHTTP adds compression to the original http.Handler's ServeHTTP() method.

type TLSOptions

type TLSOptions struct {
	InsecureSkipVerify bool
	CAFile             string
	CertFile           string
	KeyFile            string
	ServerName         string
}

Jump to

Keyboard shortcuts

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