diff options
Diffstat (limited to 'src/cowboy_http_req.erl')
-rw-r--r-- | src/cowboy_http_req.erl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cowboy_http_req.erl b/src/cowboy_http_req.erl index 323f750..69d47b0 100644 --- a/src/cowboy_http_req.erl +++ b/src/cowboy_http_req.erl @@ -181,14 +181,14 @@ headers(Req) -> %% @equiv cookie(Name, Req, undefined) -spec cookie(binary(), #http_req{}) -> {binary() | true | undefined, #http_req{}}. -cookie(Name, Req) -> +cookie(Name, Req) when is_binary(Name) -> cookie(Name, Req, undefined). %% @doc Return the cookie value for the given key, or a default if %% missing. -spec cookie(binary(), #http_req{}, Default) -> {binary() | true | Default, #http_req{}} when Default::any(). -cookie(Name, Req=#http_req{cookies=undefined}, Default) -> +cookie(Name, Req=#http_req{cookies=undefined}, Default) when is_binary(Name) -> case header('Cookie', Req) of {undefined, Req2} -> {Default, Req2#http_req{cookies=[]}}; |