0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 04:30:25 +00:00

Add cowboy_http_req:set_resp_cookie/4

Pretty much just an alias for a combination of set_resp_header and cookie.
This commit is contained in:
Loïc Hoguin 2011-12-07 11:54:57 +01:00
parent a12a910341
commit ce92ab1e63
3 changed files with 13 additions and 3 deletions

View file

@ -37,7 +37,7 @@
]). %% Request Body API.
-export([
set_resp_header/3, set_resp_body/2,
set_resp_cookie/4, set_resp_header/3, set_resp_body/2,
has_resp_header/2, has_resp_body/1,
reply/2, reply/3, reply/4,
chunked_reply/2, chunked_reply/3, chunk/2,
@ -361,6 +361,13 @@ body_qs(Req) ->
%% Response API.
%% @doc Add a cookie header to the response.
-spec set_resp_cookie(binary(), binary(), [cowboy_cookies:cookie_option()],
#http_req{}) -> {ok, #http_req{}}.
set_resp_cookie(Name, Value, Options, Req) ->
{HeaderName, HeaderValue} = cowboy_cookies:cookie(Name, Value, Options),
set_resp_header(HeaderName, HeaderValue, Req).
%% @doc Add a header to the response.
-spec set_resp_header(http_header(), iodata(), #http_req{})
-> {ok, #http_req{}}.