aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_rest.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-01-05 23:35:30 +0100
committerLoïc Hoguin <[email protected]>2013-01-05 23:35:30 +0100
commitfaeb37ed80e1f2ae2bfa0c096b2a660c271adddb (patch)
tree966151c289b7bac75d25c5749c50d5eb1b3f89f8 /src/cowboy_rest.erl
parent6edea1c12389444ce05e73733140591e49f6ee86 (diff)
downloadcowboy-faeb37ed80e1f2ae2bfa0c096b2a660c271adddb.tar.gz
cowboy-faeb37ed80e1f2ae2bfa0c096b2a660c271adddb.tar.bz2
cowboy-faeb37ed80e1f2ae2bfa0c096b2a660c271adddb.zip
Add cowboy_req:set_resp_body_fun/2
This allows streaming a body without knowing the length in advance. Also allows {stream, StreamFun} response body in the REST code.
Diffstat (limited to 'src/cowboy_rest.erl')
-rw-r--r--src/cowboy_rest.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cowboy_rest.erl b/src/cowboy_rest.erl
index 511cd20..963b2f7 100644
--- a/src/cowboy_rest.erl
+++ b/src/cowboy_rest.erl
@@ -796,8 +796,10 @@ set_resp_body(Req, State=#state{handler=Handler, handler_state=HandlerState,
{Body, Req6, HandlerState} ->
State5 = State4#state{handler_state=HandlerState},
Req7 = case Body of
- {stream, Len, Fun1} ->
- cowboy_req:set_resp_body_fun(Len, Fun1, Req6);
+ {stream, StreamFun} ->
+ cowboy_req:set_resp_body_fun(StreamFun, Req6);
+ {stream, Len, StreamFun} ->
+ cowboy_req:set_resp_body_fun(Len, StreamFun, Req6);
_Contents ->
cowboy_req:set_resp_body(Body, Req6)
end,