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

Newly documented cow_cookie:cookie_opts() is now a map

This commit is contained in:
Loïc Hoguin 2019-10-10 14:52:02 +02:00
parent d52e84bdd9
commit ecb39eea10
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764

View file

@ -98,10 +98,6 @@
%% Internal.
-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() :: #{
length => non_neg_integer() | infinity,
period => non_neg_integer(),
@ -704,11 +700,10 @@ 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(), Req, cookie_opts())
-spec set_resp_cookie(binary(), iodata(), Req, cow_cookie:cookie_opts())
-> Req when Req::req().
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, #{}),
Req#{resp_cookies => RespCookies#{Name => Cookie}}.