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:
parent
645556a80a
commit
82de4254dd
3 changed files with 8 additions and 9 deletions
|
@ -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.
|
||||
%%
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue