mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
add remaining tests
This commit is contained in:
parent
76e4786171
commit
4d08610ea1
2 changed files with 24 additions and 0 deletions
|
@ -203,6 +203,9 @@ do(<<"reply4">>, Req0, Opts) ->
|
||||||
<<"error">> ->
|
<<"error">> ->
|
||||||
ct_helper:ignore(erlang, iolist_size, 1),
|
ct_helper:ignore(erlang, iolist_size, 1),
|
||||||
cowboy_req:reply(200, #{}, ok, Req0);
|
cowboy_req:reply(200, #{}, ok, Req0);
|
||||||
|
<<"set_cookie">> ->
|
||||||
|
ct_helper:ignore(cowboy_req, reply, 4),
|
||||||
|
cowboy_req:reply(200, #{<<"set-cookie">> => <<"name=paco loco">>}, ok, Req0);
|
||||||
<<"204body">> ->
|
<<"204body">> ->
|
||||||
ct_helper:ignore(cowboy_req, do_reply_ensure_no_body, 4),
|
ct_helper:ignore(cowboy_req, do_reply_ensure_no_body, 4),
|
||||||
cowboy_req:reply(204, #{}, <<"OK">>, Req0);
|
cowboy_req:reply(204, #{}, <<"OK">>, Req0);
|
||||||
|
@ -224,6 +227,9 @@ do(<<"stream_reply2">>, Req0, Opts) ->
|
||||||
Req = cowboy_req:stream_reply(ok, Req0),
|
Req = cowboy_req:stream_reply(ok, Req0),
|
||||||
stream_body(Req),
|
stream_body(Req),
|
||||||
{ok, Req, Opts};
|
{ok, Req, Opts};
|
||||||
|
<<"set_cookie">> ->
|
||||||
|
ct_helper:ignore(cowboy_req, reply, 4),
|
||||||
|
cowboy_req:reply(200, #{<<"set-cookie">> => <<"name=paco loco">>}, ok, Req0);
|
||||||
<<"204">> ->
|
<<"204">> ->
|
||||||
Req = cowboy_req:stream_reply(204, Req0),
|
Req = cowboy_req:stream_reply(204, Req0),
|
||||||
{ok, Req, Opts};
|
{ok, Req, Opts};
|
||||||
|
@ -254,6 +260,9 @@ do(<<"stream_reply3">>, Req0, Opts) ->
|
||||||
<<"error">> ->
|
<<"error">> ->
|
||||||
ct_helper:ignore(cowboy_req, stream_reply, 3),
|
ct_helper:ignore(cowboy_req, stream_reply, 3),
|
||||||
cowboy_req:stream_reply(200, ok, Req0);
|
cowboy_req:stream_reply(200, ok, Req0);
|
||||||
|
<<"set_cookie">> ->
|
||||||
|
ct_helper:ignore(cowboy_req, stream_reply, 3),
|
||||||
|
cowboy_req:stream_reply(200, #{<<"set-cookie">> => <<"name=cormano">>}, Req0);
|
||||||
Status ->
|
Status ->
|
||||||
cowboy_req:stream_reply(binary_to_integer(Status),
|
cowboy_req:stream_reply(binary_to_integer(Status),
|
||||||
#{<<"content-type">> => <<"text/plain">>}, Req0)
|
#{<<"content-type">> => <<"text/plain">>}, Req0)
|
||||||
|
@ -409,6 +418,17 @@ do(<<"stream_trailers">>, Req0, Opts) ->
|
||||||
<<"grpc-status">> => <<"0">>
|
<<"grpc-status">> => <<"0">>
|
||||||
}, Req),
|
}, Req),
|
||||||
{ok, Req, Opts};
|
{ok, Req, Opts};
|
||||||
|
<<"set_cookie">> ->
|
||||||
|
ct_helper:ignore(cowboy_req, stream_trailers, 2),
|
||||||
|
Req = cowboy_req:stream_reply(200, #{
|
||||||
|
<<"trailer">> => <<"grpc-status">>
|
||||||
|
}, Req0),
|
||||||
|
%% The size should be larger than StreamSize and ConnSize
|
||||||
|
cowboy_req:stream_body(<<0:80000000>>, nofin, Req),
|
||||||
|
cowboy_req:stream_trailers(#{
|
||||||
|
<<"set-cookie">> => <<"name=cormano">>
|
||||||
|
}, Req),
|
||||||
|
{ok, Req, Opts};
|
||||||
_ ->
|
_ ->
|
||||||
Req = cowboy_req:stream_reply(200, #{
|
Req = cowboy_req:stream_reply(200, #{
|
||||||
<<"trailer">> => <<"grpc-status">>
|
<<"trailer">> => <<"grpc-status">>
|
||||||
|
|
|
@ -931,6 +931,7 @@ reply4(Config) ->
|
||||||
{201, _, <<"OK">>} = do_get("/resp/reply4/201", Config),
|
{201, _, <<"OK">>} = do_get("/resp/reply4/201", Config),
|
||||||
{404, _, <<"OK">>} = do_get("/resp/reply4/404", Config),
|
{404, _, <<"OK">>} = do_get("/resp/reply4/404", Config),
|
||||||
{500, _, _} = do_get("/resp/reply4/error", Config),
|
{500, _, _} = do_get("/resp/reply4/error", Config),
|
||||||
|
{500, _, _} = do_get("/resp/reply4/set_cookie", Config),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
stream_reply2(Config) ->
|
stream_reply2(Config) ->
|
||||||
|
@ -980,6 +981,7 @@ stream_reply3(Config) ->
|
||||||
{404, Headers3, Body} = do_get("/resp/stream_reply3/404", Config),
|
{404, Headers3, Body} = do_get("/resp/stream_reply3/404", Config),
|
||||||
true = lists:keymember(<<"content-type">>, 1, Headers3),
|
true = lists:keymember(<<"content-type">>, 1, Headers3),
|
||||||
{500, _, _} = do_get("/resp/stream_reply3/error", Config),
|
{500, _, _} = do_get("/resp/stream_reply3/error", Config),
|
||||||
|
{500, _, _} = do_get("/resp/stream_reply3/set_cookie", Config),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
stream_body_fin0(Config) ->
|
stream_body_fin0(Config) ->
|
||||||
|
@ -1136,6 +1138,8 @@ stream_trailers(Config) ->
|
||||||
{<<"grpc-status">>, <<"0">>}
|
{<<"grpc-status">>, <<"0">>}
|
||||||
]} = do_trailers("/resp/stream_trailers", Config),
|
]} = do_trailers("/resp/stream_trailers", Config),
|
||||||
{_, <<"grpc-status">>} = lists:keyfind(<<"trailer">>, 1, RespHeaders),
|
{_, <<"grpc-status">>} = lists:keyfind(<<"trailer">>, 1, RespHeaders),
|
||||||
|
|
||||||
|
{500, _, _} = do_trailers("resp/stream_trailers/set_cookie", Config),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
stream_trailers_large(Config) ->
|
stream_trailers_large(Config) ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue