0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

stream trailers test

This commit is contained in:
geeksilva97 2024-01-10 21:41:18 -03:00
parent a3e402db1f
commit 31b0aa024e
2 changed files with 15 additions and 2 deletions

View file

@ -419,6 +419,16 @@ do(<<"stream_trailers">>, Req0, Opts) ->
<<"grpc-status">> => <<"0">>
}, Req),
{ok, Req, Opts};
<<"set_cookie">> ->
ct_helper:ignore(cowboy_req, stream_trailers, 2),
Req = cowboy_req:stream_reply(200, #{
<<"trailer">> => <<"grpc-status">>
}, Req0),
cowboy_req:stream_body(<<"Testing dang cookies">>, nofin, Req),
cowboy_req:stream_trailers(#{
<<"set-cookie">> => <<"name=hello">>
}, Req),
{ok, Req, Opts};
_ ->
Req = cowboy_req:stream_reply(200, #{
<<"trailer">> => <<"grpc-status">>

View file

@ -1140,6 +1140,11 @@ stream_trailers(Config) ->
{_, <<"grpc-status">>} = lists:keyfind(<<"trailer">>, 1, RespHeaders),
ok.
stream_trailers_set_cookie(Config) ->
doc("Stream with set-cookie header."),
do_trailers("/resp/stream_trailers/set_cookie", Config),
ok.
stream_trailers_large(Config) ->
doc("Stream large body followed by trailer headers."),
{200, RespHeaders, <<0:80000000>>, [
@ -1167,8 +1172,6 @@ do_trailers(Path, Config) ->
{<<"accept-encoding">>, <<"gzip">>},
{<<"te">>, <<"trailers">>}
]),
{response, nofin, Status, RespHeaders} = gun:await(ConnPid, Ref, infinity),
{ok, RespBody, Trailers} = gun:await_body(ConnPid, Ref, infinity),
gun:close(ConnPid),