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.
Doer defines the method required for an HTTP client to execute requests. An *http.Client satisfies this interface.
Wrap wraps the Doer d with the provided middleware ws. It returns a Doer that will call ws -> ws -> ... -> ws[n-1] -> d. Each Wrapper may stop the chain of calls by not calling the next Doer in the chain.
DoerFunc is a function signature that satisfies the Doer interface.
Do satisfies the Doer interface for a DoerFunc by calling the function.
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).
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.
Log implements Logger for the PrintfLogger function adapter.
Wrapper defines the Wrap method required to build a middleware-style chain of calls.
WrapperFunc is a function type that satisfies the Wrapper interface.
Wrap satisfies the Wrapper interface for a WrapperFunc by calling the function.
|headers||Package headers defines a middleware that adds static headers to the requests.|
|logrequest||Package logrequest implements a middleware that logs requests.|
|requestid||Package requestid implements an HTTP client middleware that generates a random request ID.|