Documentation ¶
Overview ¶
Package middlewares contains a set of tools used to handle input requests.
In order to add middlewares, it's recommended to use funcs that returns func (*Context), given consumer the possibility of using it later into Exec.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseBodyJson ¶
func ParseBodyJson(body interface{}) func(c *Context)
ParseBodyJson will return a func that will decode request's body into the given interface. Its return is a func (c *Context) to be used into Context.Exec if needed.
Types ¶
type Context ¶
type Context struct { Err error Status int Response interface{} Body interface{} // contains filtered or unexported fields }
Context will store data cross handlers
func NewContext ¶
func NewContext( req *http.Request, rw http.ResponseWriter, method string, headers map[string]string, ) (ctx *Context)
NewContext generates the context and validates if method and headers providad in requests match agains route's expected
Click to show internal directories.
Click to hide internal directories.