0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Handler:init/2 should also return the Request in case it changed.

This commit is contained in:
Loïc Hoguin 2011-03-18 01:52:46 +01:00
parent f53235549d
commit 5e80e4baac
2 changed files with 2 additions and 2 deletions

View file

@ -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!"}.

View file

@ -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.