mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Handle error_response command in cowboy_metrics_h
This commit is contained in:
parent
473e3fb82b
commit
5ab5615ff0
3 changed files with 145 additions and 0 deletions
|
@ -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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue