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

Don't send transfer-encoding when streaming 204 responses

This commit is contained in:
Loïc Hoguin 2018-05-18 18:03:56 +02:00
parent 763eef4e46
commit 5229d790fb
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
3 changed files with 23 additions and 16 deletions

View file

@ -169,17 +169,24 @@ do(<<"reply4">>, Req0, Opts) ->
end,
{ok, Req, Opts};
do(<<"stream_reply2">>, Req0, Opts) ->
Req = case cowboy_req:binding(arg, Req0) of
case cowboy_req:binding(arg, Req0) of
<<"binary">> ->
cowboy_req:stream_reply(<<"200 GOOD">>, Req0);
Req = cowboy_req:stream_reply(<<"200 GOOD">>, Req0),
stream_body(Req),
{ok, Req, Opts};
<<"error">> ->
ct_helper:ignore(cowboy_req, stream_reply, 3),
cowboy_req:stream_reply(ok, Req0);
Req = cowboy_req:stream_reply(ok, Req0),
stream_body(Req),
{ok, Req, Opts};
<<"204">> ->
Req = cowboy_req:stream_reply(204, Req0),
{ok, Req, Opts};
Status ->
cowboy_req:stream_reply(binary_to_integer(Status), Req0)
end,
stream_body(Req),
{ok, Req, Opts};
Req = cowboy_req:stream_reply(binary_to_integer(Status), Req0),
stream_body(Req),
{ok, Req, Opts}
end;
do(<<"stream_reply3">>, Req0, Opts) ->
Req = case cowboy_req:binding(arg, Req0) of
<<"error">> ->