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

Make cowboy_req:has_body/1 return boolean()

This makes it similar to the other has_* functions.
This commit is contained in:
Loïc Hoguin 2013-01-19 17:20:35 +01:00
parent 645556a80a
commit 82de4254dd
3 changed files with 8 additions and 9 deletions

View file

@ -555,11 +555,10 @@ set_meta(Name, Value, Req=#http_req{meta=Meta}) ->
%% Request Body API.
%% @doc Return whether the request message has a body.
-spec has_body(Req) -> {boolean(), Req} when Req::req().
-spec has_body(cowboy_req:req()) -> boolean().
has_body(Req) ->
Has = lists:keymember(<<"content-length">>, 1, Req#http_req.headers) orelse
lists:keymember(<<"transfer-encoding">>, 1, Req#http_req.headers),
{Has, Req}.
lists:keymember(<<"content-length">>, 1, Req#http_req.headers) orelse
lists:keymember(<<"transfer-encoding">>, 1, Req#http_req.headers).
%% @doc Return the request message body length, if known.
%%