diff options
Diffstat (limited to 'src/cowboy_handler.erl')
-rw-r--r-- | src/cowboy_handler.erl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cowboy_handler.erl b/src/cowboy_handler.erl index af21342..4dbe226 100644 --- a/src/cowboy_handler.erl +++ b/src/cowboy_handler.erl @@ -39,7 +39,7 @@ execute(Req, Env=#{handler := Handler, handler_opts := HandlerOpts}) -> try Handler:init(Req, HandlerOpts) of {ok, Req2, State} -> Result = terminate(normal, Req2, State, Handler), - {ok, Req2, [{result, Result}|Env]}; + {ok, Req2, Env#{result => Result}}; {Mod, Req2, State} -> Mod:upgrade(Req2, Env, Handler, State, infinity, run); {Mod, Req2, State, hibernate} -> @@ -53,7 +53,7 @@ execute(Req, Env=#{handler := Handler, handler_opts := HandlerOpts}) -> erlang:raise(Class, Reason, erlang:get_stacktrace()) end. --spec terminate(any(), Req, any(), module()) -> ok when Req::cowboy_req:req(). +-spec terminate(any(), Req | undefined, any(), module()) -> ok when Req::cowboy_req:req(). terminate(Reason, Req, State, Handler) -> case erlang:function_exported(Handler, terminate, 3) of true -> |