aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2013-02-01 10:40:00 -0600
committerTristan Sloughter <[email protected]>2013-02-01 10:41:45 -0600
commit29c4508884f4e70dc23f486da64aee491009b124 (patch)
tree89c28f8e9f348978241db4f5f20b6684c32aa088 /src
parent855e9652fa40673d8f1ff40fd262963941e28fef (diff)
downloadcowboy-29c4508884f4e70dc23f486da64aee491009b124.tar.gz
cowboy-29c4508884f4e70dc23f486da64aee491009b124.tar.bz2
cowboy-29c4508884f4e70dc23f486da64aee491009b124.zip
add guards on set_resp_body_fun for streamlen and streamfun
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_req.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl
index 0745192..b3bc375 100644
--- a/src/cowboy_req.erl
+++ b/src/cowboy_req.erl
@@ -847,7 +847,7 @@ set_resp_body(Body, Req) ->
%% Cowboy will add a "Transfer-Encoding: identity" header to the
%% response.
-spec set_resp_body_fun(resp_body_fun(), Req) -> Req when Req::req().
-set_resp_body_fun(StreamFun, Req) ->
+set_resp_body_fun(StreamFun, Req) when is_function(StreamFun) ->
Req#http_req{resp_body=StreamFun}.
%% @doc Add a body function to the response.
@@ -863,7 +863,7 @@ set_resp_body_fun(StreamFun, Req) ->
%% fewer bytes than declared the behaviour is undefined.
-spec set_resp_body_fun(non_neg_integer(), resp_body_fun(), Req)
-> Req when Req::req().
-set_resp_body_fun(StreamLen, StreamFun, Req) ->
+set_resp_body_fun(StreamLen, StreamFun, Req) when is_integer(StreamLen), is_function(StreamFun) ->
Req#http_req{resp_body={StreamLen, StreamFun}}.
%% @doc Return whether the given header has been set for the response.