Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AfterFunc ¶
type AfterFunc func(context.Context, http.ResponseWriter)
AfterFunc may take information from a request context and use it to manipulate a ResponseWriter. AfterFuncs are executed in the handler, after invoking the endpoint but prior to writing a response.
func SetContentType ¶
SetContentType returns an AfterFunc that sets the Content-Type header to the provided value.
type BeforeFunc ¶
BeforeFunc may take information from an HTTP request and put it into a request context. BeforeFuncs are executed in the handler, prior to invoking the endpoint.
type DecodeFunc ¶
DecodeFunc converts an HTTP request (transport-domain) to a user request (business-domain). One straightforward DecodeFunc could be something that JSON-decodes the request body to a concrete request type.
type EncodeFunc ¶
type EncodeFunc func(http.ResponseWriter, interface{}) error
EncodeFunc converts a user response (business-domain) to an HTTP response (transport-domain) by encoding the interface to the response writer.
type Server ¶
type Server struct { context.Context endpoint.Endpoint DecodeFunc EncodeFunc Before []BeforeFunc After []AfterFunc }
Server wraps an endpoint and implements http.Handler.