aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-06-06 17:30:13 +0200
committerLoïc Hoguin <[email protected]>2016-06-06 17:30:13 +0200
commit84b3b61b392c00789cabe2f6f736c0a116f0fb85 (patch)
tree56f0a8ad9518423c949164d99a58a22fadd139e5
parent725bdb97747a5fb9ae36246843b10bf91301c111 (diff)
downloadcowboy-84b3b61b392c00789cabe2f6f736c0a116f0fb85.tar.gz
cowboy-84b3b61b392c00789cabe2f6f736c0a116f0fb85.tar.bz2
cowboy-84b3b61b392c00789cabe2f6f736c0a116f0fb85.zip
Remove the environment from cowboy_rest crash reports
It only serves to pollute logs.
-rw-r--r--src/cowboy_rest.erl14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cowboy_rest.erl b/src/cowboy_rest.erl
index 914b273..2401c04 100644
--- a/src/cowboy_rest.erl
+++ b/src/cowboy_rest.erl
@@ -198,7 +198,6 @@
%% End of REST callbacks. Whew!
-record(state, {
- env :: cowboy_middleware:env(),
method = undefined :: binary(),
%% Handler.
@@ -235,10 +234,11 @@
-spec upgrade(Req, Env, module(), any(), infinity, run)
-> {ok, Req, Env} when Req::cowboy_req:req(), Env::cowboy_middleware:env().
-upgrade(Req, Env, Handler, HandlerState, infinity, run) ->
- Method = cowboy_req:method(Req),
- service_available(Req, #state{env=Env, method=Method,
- handler=Handler, handler_state=HandlerState}).
+upgrade(Req0, Env, Handler, HandlerState, infinity, run) ->
+ Method = cowboy_req:method(Req0),
+ {ok, Req, Result} = service_available(Req0, #state{method=Method,
+ handler=Handler, handler_state=HandlerState}),
+ {ok, Req, [{result, Result}|Env]}.
service_available(Req, State) ->
expect(Req, State, service_available, true, fun known_methods/2, 503).
@@ -1156,6 +1156,6 @@ error_terminate(Req, #state{handler=Handler, handler_state=HandlerState},
{state, HandlerState}
]}).
-terminate(Req, #state{env=Env, handler=Handler, handler_state=HandlerState}) ->
+terminate(Req, #state{handler=Handler, handler_state=HandlerState}) ->
Result = cowboy_handler:terminate(normal, Req, HandlerState, Handler),
- {ok, Req, [{result, Result}|Env]}.
+ {ok, Req, Result}.