Documentation ¶
Overview ¶
Package httpcmw supports creating middleware chains for HTTP clients. It abstracts the *http.Client into a Doer interface and wraps middleware around the Do call.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Doer ¶
Doer defines the method required for an HTTP client to execute requests. An *http.Client satisfies this interface.
type Logger ¶
type Logger interface {
Log(...interface{}) error
}
Logger defines the Log method that is used to log structured data, in tuples of alternating keys/values. The go-kit logger satisfies this interface (github.com/go-kit/kit/log).
type PrintfLogger ¶
type PrintfLogger func(string, ...interface{})
PrintfLogger is an adapter to use Printf-style functions as a Logger in the middlewares that accept one. For example, the stdlib's log.Printf function can be used via this adapter.
func (PrintfLogger) Log ¶
func (fn PrintfLogger) Log(args ...interface{}) error
Log implements Logger for the PrintfLogger function adapter.
type WrapperFunc ¶
WrapperFunc is a function type that satisfies the Wrapper interface.
func (WrapperFunc) Wrap ¶
func (fn WrapperFunc) Wrap(d Doer) Doer
Wrap satisfies the Wrapper interface for a WrapperFunc by calling the function.
Directories ¶
Path | Synopsis |
---|---|
Package headers defines a middleware that adds static headers to the requests.
|
Package headers defines a middleware that adds static headers to the requests. |
Package logrequest implements a middleware that logs requests.
|
Package logrequest implements a middleware that logs requests. |
Package requestid implements an HTTP client middleware that generates a random request ID.
|
Package requestid implements an HTTP client middleware that generates a random request ID. |