mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 20:50:24 +00:00
Remove the onrequest hook
It was redundant with middlewares. Allows us to save a few operations for every incoming requests.
This commit is contained in:
parent
25259671f5
commit
aa4d86b81f
12 changed files with 86 additions and 260 deletions
|
@ -25,15 +25,6 @@ A binary status can be used to set a custom message.
|
|||
|
||||
HTTP version.
|
||||
|
||||
: onrequest_fun() = fun((cowboy_req:req()) -> cowboy_req:req())
|
||||
|
||||
Fun called immediately after receiving a request.
|
||||
|
||||
It can perform any operation on the Req object, including
|
||||
reading the request body or replying. If a reply is sent,
|
||||
the processing of the request ends here, before any middleware
|
||||
is executed.
|
||||
|
||||
: onresponse_fun() = fun((http_status(), http_headers(),
|
||||
iodata(), cowboy_req:req()) -> cowboy_req:req())
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ as a Ranch protocol.
|
|||
| {max_keepalive, non_neg_integer()}
|
||||
| {max_request_line_length, non_neg_integer()}
|
||||
| {middlewares, [module()]}
|
||||
| {onrequest, cowboy:onrequest_fun()}
|
||||
| {onresponse, cowboy:onresponse_fun()}
|
||||
| {timeout, timeout()}]
|
||||
|
||||
|
@ -67,10 +66,6 @@ Maximum length of the request line.
|
|||
|
||||
List of middlewares to execute for every requests.
|
||||
|
||||
: onrequest (undefined)
|
||||
|
||||
Fun called every time a request is received.
|
||||
|
||||
: onresponse (undefined)
|
||||
|
||||
Fun called every time a response is sent.
|
||||
|
|
|
@ -126,8 +126,7 @@ Types:
|
|||
Return the requested URL excluding the path component.
|
||||
|
||||
This function will always return `undefined` until the
|
||||
`cowboy_router` middleware has been executed. This includes
|
||||
the `onrequest` hook.
|
||||
`cowboy_router` middleware has been executed.
|
||||
|
||||
: match_cookies(Req, Fields) -> Map
|
||||
|
||||
|
@ -371,8 +370,7 @@ Types:
|
|||
Return the requested URL.
|
||||
|
||||
This function will always return `undefined` until the
|
||||
`cowboy_router` middleware has been executed. This includes
|
||||
the `onrequest` hook.
|
||||
`cowboy_router` middleware has been executed.
|
||||
|
||||
: version(Req) -> Version
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ The `cowboy_spdy` module implements SPDY/3 as a Ranch protocol.
|
|||
|
||||
: opts() = [{env, cowboy_middleware:env()}
|
||||
| {middlewares, [module()]}
|
||||
| {onrequest, cowboy:onrequest_fun()}
|
||||
| {onresponse, cowboy:onresponse_fun()}]
|
||||
|
||||
Configuration for the SPDY protocol handler.
|
||||
|
@ -30,10 +29,6 @@ Initial middleware environment.
|
|||
|
||||
List of middlewares to execute for every requests.
|
||||
|
||||
: onrequest (undefined)
|
||||
|
||||
Fun called every time a request is received.
|
||||
|
||||
: onresponse (undefined)
|
||||
|
||||
Fun called every time a response is sent.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue