mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Handler:init/2 should also return the Request in case it changed.
This commit is contained in:
parent
f53235549d
commit
5e80e4baac
2 changed files with 2 additions and 2 deletions
|
@ -66,7 +66,7 @@ handler could be written like this:
|
|||
-export([init/2, handle/2]).
|
||||
|
||||
init(Req, Opts) ->
|
||||
{ok, undefined}.
|
||||
{ok, Req, undefined}.
|
||||
|
||||
handle(Req, State) ->
|
||||
{reply, 200, [], "Hello World!"}.
|
||||
|
|
|
@ -111,7 +111,7 @@ header(http_eoh, Req, State) ->
|
|||
-spec handler_init(Req::#http_req{}, State::#state{}) -> ok.
|
||||
handler_init(Req, State=#state{handler={Handler, Opts}}) ->
|
||||
case Handler:init(Req, Opts) of
|
||||
{ok, HandlerState} ->
|
||||
{ok, Req, HandlerState} ->
|
||||
handler_loop(HandlerState, Req, State)
|
||||
%% @todo {mode, active}; {upgrade_protocol, Module}; {error, Reason}
|
||||
end.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue