transport

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2015 License: Apache-2.0, BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneRequest

func CloneRequest(r *http.Request) *http.Request

CloneRequest returns a clone of the provided *http.Request. The clone is a shallow copy of the struct and its Header map.

func NewTransport

func NewTransport(base http.RoundTripper, modifiers ...RequestModifier) http.RoundTripper

NewTransport returns an http.RoundTripper that modifies requests according to the RequestModifiers passed in the arguments, before sending the requests to the base http.RoundTripper (which, if nil, defaults to http.DefaultTransport).

Types

type OnEOFReader

type OnEOFReader struct {
	Rc io.ReadCloser
	Fn func()
}

OnEOFReader ensures a callback function is called on Close() and when the underlying Reader returns an io.EOF error

func (*OnEOFReader) Close

func (r *OnEOFReader) Close() error

func (*OnEOFReader) Read

func (r *OnEOFReader) Read(p []byte) (n int, err error)

type RequestModifier

type RequestModifier interface {
	ModifyRequest(*http.Request) error
}

func NewHeaderRequestModifier

func NewHeaderRequestModifier(header http.Header) RequestModifier

NewHeaderRequestModifier returns a RequestModifier that merges the HTTP headers passed as an argument, with the HTTP headers of a request.

If the same key is present in both, the modifying header values for that key, are appended to the values for that same key in the request header.

Jump to

Keyboard shortcuts

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