Documentation ¶
Overview ¶
`httpwares` is a collection of middlewares (server-side) and tripperwares (client-side) for vanilla Golang HTTP libs
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapClient ¶
func WrapClient(client *http.Client, wares ...Tripperware) *http.Client
WrapClient takes an http.Client and wraps its transport in the chain of tripperwares.
Types ¶
type Middleware ¶
Middleware is signature of all http server-side middleware.
type RoundTripperFunc ¶
RoundTripperFunc wraps a func to make it into a http.RoundTripper. Similar to http.HandleFunc.
type Tripperware ¶
type Tripperware func(http.RoundTripper) http.RoundTripper
Tripperware is a signature for all http client-side middleware.
type WrappedResponseWriter ¶
type WrappedResponseWriter interface { http.ResponseWriter // Status returns the HTTP status of the request, or 0 if one has not // yet been sent. StatusCode() int // MessageLength returns the size of the HTTP Response Message (after headers), as returned to the client. MessageLength() int // ObserveWriteHeader adds to the list of callbacks to be triggered when WriteHeader is executed. ObserveWriteHeader(func(t WrappedResponseWriter, code int)) // ObserveWrite adds to the list of callbacks to be triggered when a Write() is executed. ObserveWrite(func(t WrappedResponseWriter, buf []byte, n int, err error)) }
WrappedResponseWriter is a wrapper around http.ResponseWriter that is useful for building middlewares.
If you want to instantiate this, please use `WrapResponseWriter` function.
func WrapResponseWriter ¶
func WrapResponseWriter(w http.ResponseWriter) WrappedResponseWriter
WrapResponseWriter wraps the http.ResponseWriter in a helper thats useful for building middlewares.
This call *reuses* the existing WrappedResponseWriter, i.e. if it is already wrapped, the existing wrapper will be returned.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
logrus
`http_logrus` is a HTTP logging middleware for the Logrus logging stack.
|
`http_logrus` is a HTTP logging middleware for the Logrus logging stack. |
logrus/ctxlogrus
ctxlogrus allows you to store or extract a logrus logger from the context.
|
ctxlogrus allows you to store or extract a logrus logger from the context. |
`http_metrics` provides client and server side reporting of HTTP stats.
|
`http_metrics` provides client and server side reporting of HTTP stats. |
`http_retry` is a HTTP client-side Tripperware that allows you to retry requests that are marked as idempotent and safe.
|
`http_retry` is a HTTP client-side Tripperware that allows you to retry requests that are marked as idempotent and safe. |
`http_ctxtags` adds a Tag object to the request's context that identifies it for other wares.
|
`http_ctxtags` adds a Tag object to the request's context that identifies it for other wares. |
tracing
|
|
debug
`http_debug` adds /debug/request debugging information for HTTP requests.
|
`http_debug` adds /debug/request debugging information for HTTP requests. |
opentracing
`http_opentracing` adds OpenTracing wares for HTTP libraries.
|
`http_opentracing` adds OpenTracing wares for HTTP libraries. |