aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGrigory Starinkin <[email protected]>2018-10-20 10:11:14 +0100
committerLoïc Hoguin <[email protected]>2018-10-31 15:13:23 +0100
commit5ab5615ff0bc13e449cc3ff7ef528ffdeb1feb1f (patch)
tree1f7bb40c661cc253b3078f8efc1a8d014c38ca3e /src
parent473e3fb82bd56a984dcf8936a51e3fd8affcb8f4 (diff)
downloadcowboy-5ab5615ff0bc13e449cc3ff7ef528ffdeb1feb1f.tar.gz
cowboy-5ab5615ff0bc13e449cc3ff7ef528ffdeb1feb1f.tar.bz2
cowboy-5ab5615ff0bc13e449cc3ff7ef528ffdeb1feb1f.zip
Handle error_response command in cowboy_metrics_h
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_metrics_h.erl10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cowboy_metrics_h.erl b/src/cowboy_metrics_h.erl
index 3a2a8f0..f9a1363 100644
--- a/src/cowboy_metrics_h.erl
+++ b/src/cowboy_metrics_h.erl
@@ -222,6 +222,16 @@ fold([{response, Status, Headers, Body}|Tail],
resp_end=Resp,
resp_body_length=resp_body_length(Body)
});
+fold([{error_response, Status, Headers, Body}|Tail],
+ State=#state{resp_status=RespStatus}) ->
+ %% The error_response command only results in a response
+ %% if no response was sent before.
+ case RespStatus of
+ undefined ->
+ fold([{response, Status, Headers, Body}|Tail], State);
+ _ ->
+ fold(Tail, State)
+ end;
fold([{headers, Status, Headers}|Tail],
State=#state{resp_headers_filter=RespHeadersFilter}) ->
RespStart = erlang:monotonic_time(),