aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-10-20 18:00:40 +0100
committerLoïc Hoguin <[email protected]>2017-10-20 18:00:40 +0100
commit1ef5a1c45bd56fb9080ff0195c5ea74f88bcd71a (patch)
treefafe3bfa277c2ae5735aeea064b47a3634a5762e /src
parent4211ea41bd49be3cf152acb62ac8330f7f6a927d (diff)
downloadcowboy-1ef5a1c45bd56fb9080ff0195c5ea74f88bcd71a.tar.gz
cowboy-1ef5a1c45bd56fb9080ff0195c5ea74f88bcd71a.tar.bz2
cowboy-1ef5a1c45bd56fb9080ff0195c5ea74f88bcd71a.zip
Add a test for metrics with a request body
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_metrics_h.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cowboy_metrics_h.erl b/src/cowboy_metrics_h.erl
index 91709ad..1203518 100644
--- a/src/cowboy_metrics_h.erl
+++ b/src/cowboy_metrics_h.erl
@@ -152,8 +152,10 @@ data(StreamID, IsFin, Data, State=#state{req_body_start=undefined}) ->
req_body_start=ReqBodyStart,
req_body_length=byte_size(Data)
});
-data(StreamID, IsFin, Data, State) ->
- do_data(StreamID, IsFin, Data, State).
+data(StreamID, IsFin, Data, State=#state{req_body_length=ReqBodyLen}) ->
+ do_data(StreamID, IsFin, Data, State#state{
+ req_body_length=ReqBodyLen + byte_size(Data)
+ }).
do_data(StreamID, IsFin, Data, State0=#state{next=Next0}) ->
{Commands, Next} = cowboy_stream:data(StreamID, IsFin, Data, Next0),