aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_http.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-07-03 17:22:43 +0200
committerLoïc Hoguin <[email protected]>2019-07-03 17:22:43 +0200
commit071599cbcd25cd2669e26d23a6e202e0275f191a (patch)
tree58805ebdf34d3f2830b9d5ef6817e1e077d94790 /src/gun_http.erl
parentd6b7ec654a876531dc0cfc7c65350d354bda2f52 (diff)
downloadgun-071599cbcd25cd2669e26d23a6e202e0275f191a.tar.gz
gun-071599cbcd25cd2669e26d23a6e202e0275f191a.tar.bz2
gun-071599cbcd25cd2669e26d23a6e202e0275f191a.zip
Add the response_trailers event
Diffstat (limited to 'src/gun_http.erl')
-rw-r--r--src/gun_http.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl
index b7c5bc1..4acc3c4 100644
--- a/src/gun_http.erl
+++ b/src/gun_http.erl
@@ -197,10 +197,12 @@ handle(Data, State=#http_state{in=body_trailer, buffer=Buffer, connection=Conn,
{Trailers, Rest} = cow_http:parse_headers(Data2),
%% @todo We probably want to pass this to gun_content_handler?
ReplyTo ! {gun_trailers, self(), stream_ref(StreamRef), Trailers},
- EvHandlerState = EvHandler:response_end(#{
+ ResponseEvent = #{
stream_ref => StreamRef,
reply_to => ReplyTo
- }, EvHandlerState0),
+ },
+ EvHandlerState1 = EvHandler:response_trailers(ResponseEvent#{headers => Trailers}, EvHandlerState0),
+ EvHandlerState = EvHandler:response_end(ResponseEvent, EvHandlerState1),
case Conn of
keepalive ->
handle(Rest, end_stream(State#http_state{buffer= <<>>}), EvHandler, EvHandlerState);