diff options
author | Loïc Hoguin <[email protected]> | 2017-11-15 14:58:49 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-11-15 14:58:49 +0100 |
commit | 39baed6c800fa9e756f7491063ead399a23083f4 (patch) | |
tree | 7c54a8b83b5957438e76c3a56996af4e4ca02c18 /test/handlers/resp_h.erl | |
parent | a1ad482eb442ea2bd54866656b7a7dc453e4bd8e (diff) | |
download | cowboy-39baed6c800fa9e756f7491063ead399a23083f4.tar.gz cowboy-39baed6c800fa9e756f7491063ead399a23083f4.tar.bz2 cowboy-39baed6c800fa9e756f7491063ead399a23083f4.zip |
Add preliminary support for trailers in responses
This depends on changes in Cowlib that are only available on
master.
Diffstat (limited to 'test/handlers/resp_h.erl')
-rw-r--r-- | test/handlers/resp_h.erl | 12 |
1 files changed, 12 insertions, 0 deletions
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">> -> |