From 39baed6c800fa9e756f7491063ead399a23083f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 15 Nov 2017 14:58:49 +0100 Subject: Add preliminary support for trailers in responses This depends on changes in Cowlib that are only available on master. --- src/cowboy_req.erl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/cowboy_req.erl') diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl index 253564d..da3a0a4 100644 --- a/src/cowboy_req.erl +++ b/src/cowboy_req.erl @@ -81,6 +81,7 @@ %% @todo stream_body/2 (nofin) -export([stream_body/3]). %% @todo stream_event/2,3 +-export([stream_trailers/2]). -export([push/3]). -export([push/4]). @@ -774,6 +775,11 @@ stream_body(Data, IsFin, #{pid := Pid, streamid := StreamID, has_sent_resp := he Pid ! {{Pid, StreamID}, {data, IsFin, Data}}, ok. +-spec stream_trailers(cowboy:http_headers(), req()) -> ok. +stream_trailers(Trailers, #{pid := Pid, streamid := StreamID, has_sent_resp := headers}) -> + Pid ! {{Pid, StreamID}, {trailers, Trailers}}, + ok. + -spec push(binary(), cowboy:http_headers(), req()) -> ok. push(Path, Headers, Req) -> push(Path, Headers, Req, #{}). -- cgit v1.2.3