Browse Source

Newly documented cow_cookie:cookie_opts() is now a map

Loïc Hoguin 5 years ago
parent
commit
ecb39eea10
1 changed files with 2 additions and 7 deletions
  1. 2 7
      src/cowboy_req.erl

+ 2 - 7
src/cowboy_req.erl

@@ -98,10 +98,6 @@
 %% Internal.
 %% Internal.
 -export([response_headers/2]).
 -export([response_headers/2]).
 
 
-%% @todo Get rid of this type, use cow_cookie directly.
--type cookie_opts() :: map().
--export_type([cookie_opts/0]).
-
 -type read_body_opts() :: #{
 -type read_body_opts() :: #{
 	length => non_neg_integer() | infinity,
 	length => non_neg_integer() | infinity,
 	period => non_neg_integer(),
 	period => non_neg_integer(),
@@ -704,11 +700,10 @@ set_resp_cookie(Name, Value, Req) ->
 %%
 %%
 %% The cookie value cannot contain any of the following characters:
 %% The cookie value cannot contain any of the following characters:
 %%   ,; \t\r\n\013\014
 %%   ,; \t\r\n\013\014
-%% @todo Fix the cookie_opts() type.
--spec set_resp_cookie(binary(), iodata(), Req, cookie_opts())
+-spec set_resp_cookie(binary(), iodata(), Req, cow_cookie:cookie_opts())
 	-> Req when Req::req().
 	-> Req when Req::req().
 set_resp_cookie(Name, Value, Req, Opts) ->
 set_resp_cookie(Name, Value, Req, Opts) ->
-	Cookie = cow_cookie:setcookie(Name, Value, maps:to_list(Opts)),
+	Cookie = cow_cookie:setcookie(Name, Value, Opts),
 	RespCookies = maps:get(resp_cookies, Req, #{}),
 	RespCookies = maps:get(resp_cookies, Req, #{}),
 	Req#{resp_cookies => RespCookies#{Name => Cookie}}.
 	Req#{resp_cookies => RespCookies#{Name => Cookie}}.