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. --- test/handlers/resp_h.erl | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/handlers') diff --git a/test/handlers/resp_h.erl b/test/handlers/resp_h.erl index add90ad..19686ff 100644 --- a/test/handlers/resp_h.erl +++ b/test/handlers/resp_h.erl @@ -204,6 +204,18 @@ do(<<"stream_body">>, Req0, Opts) -> cowboy_req:stream_body(<<0:800000>>, fin, Req0), {ok, Req0, Opts} end; +do(<<"stream_trailers">>, Req0, Opts) -> + case cowboy_req:binding(arg, Req0) of + _ -> + Req = cowboy_req:stream_reply(200, #{ + <<"trailer">> => <<"grpc-status">> + }, Req0), + cowboy_req:stream_body(<<"Hello world!">>, nofin, Req), + cowboy_req:stream_trailers(#{ + <<"grpc-status">> => <<"0">> + }, Req), + {ok, Req, Opts} + end; do(<<"push">>, Req, Opts) -> case cowboy_req:binding(arg, Req) of <<"method">> -> -- cgit v1.2.3