diff options
author | Grigory Starinkin <[email protected]> | 2018-10-20 10:11:14 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-10-31 15:13:23 +0100 |
commit | 5ab5615ff0bc13e449cc3ff7ef528ffdeb1feb1f (patch) | |
tree | 1f7bb40c661cc253b3078f8efc1a8d014c38ca3e /src | |
parent | 473e3fb82bd56a984dcf8936a51e3fd8affcb8f4 (diff) | |
download | cowboy-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.erl | 10 |
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(), |