mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
stream trailers test
This commit is contained in:
parent
a3e402db1f
commit
31b0aa024e
2 changed files with 15 additions and 2 deletions
|
@ -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">>
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue