From 91ae70b06c9cc486ea2c2cf91b94de799ceb53b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sun, 19 Feb 2017 09:46:11 +0100 Subject: Change the order of set_resp_cookie arguments The Opts value is put last, to be more consistent with the rest of the cowboy_req module. Additionally a test handler was fixed which reduced the number of errors in http_SUITE. --- src/cowboy_req.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl index 84bfee5..ca31105 100644 --- a/src/cowboy_req.erl +++ b/src/cowboy_req.erl @@ -548,7 +548,7 @@ stream_multipart(Req=#{multipart := {Boundary, Buffer}}, _) -> -spec set_resp_cookie(iodata(), iodata(), Req) -> Req when Req::req(). set_resp_cookie(Name, Value, Req) -> - set_resp_cookie(Name, Value, #{}, Req). + set_resp_cookie(Name, Value, Req, #{}). %% The cookie name cannot contain any of the following characters: %% =,;\s\t\r\n\013\014 @@ -556,9 +556,9 @@ set_resp_cookie(Name, Value, Req) -> %% The cookie value cannot contain any of the following characters: %% ,; \t\r\n\013\014 %% @todo Fix the cookie_opts() type. --spec set_resp_cookie(binary(), iodata(), cookie_opts(), Req) +-spec set_resp_cookie(binary(), iodata(), Req, cookie_opts()) -> Req when Req::req(). -set_resp_cookie(Name, Value, Opts, Req) -> +set_resp_cookie(Name, Value, Req, Opts) -> Cookie = cow_cookie:setcookie(Name, Value, maps:to_list(Opts)), RespCookies = maps:get(resp_cookies, Req, #{}), Req#{resp_cookies => RespCookies#{Name => Cookie}}. -- cgit v1.2.3