mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 12:40:25 +00:00
Merge branch 'chunked-set-resp-body-fun' of git://github.com/fishcakez/cowboy
This commit is contained in:
commit
83e8ebb9ff
4 changed files with 102 additions and 19 deletions
|
@ -19,7 +19,11 @@ handle(Req, State=#state{headers=_Headers, body=Body, reply=Reply}) ->
|
|||
SLen = iolist_size(Body),
|
||||
cowboy_req:set_resp_body_fun(SLen, SFun, Req);
|
||||
set_resp_close ->
|
||||
cowboy_req:set_resp_body_fun(SFun, Req)
|
||||
cowboy_req:set_resp_body_fun(SFun, Req);
|
||||
set_resp_chunked ->
|
||||
%% Here Body should be a list of chunks, not a binary.
|
||||
SFun2 = fun(SendFun) -> lists:foreach(SendFun, Body) end,
|
||||
cowboy_req:set_resp_body_fun(chunked, SFun2, Req)
|
||||
end,
|
||||
{ok, Req3} = cowboy_req:reply(200, Req2),
|
||||
{ok, Req3, State}.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue