mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Fix cookie example
This commit is contained in:
parent
a55679b231
commit
84fb85e2e4
3 changed files with 26 additions and 8 deletions
|
@ -6,7 +6,7 @@
|
|||
-export([init/2]).
|
||||
|
||||
init(Req, Opts) ->
|
||||
NewValue = integer_to_list(random:uniform(1000000)),
|
||||
NewValue = integer_to_list(rand:uniform(1000000)),
|
||||
Req2 = cowboy_req:set_resp_cookie(
|
||||
<<"server">>, NewValue, [{path, <<"/">>}], Req),
|
||||
#{client := ClientCookie, server := ServerCookie}
|
||||
|
@ -15,7 +15,7 @@ init(Req, Opts) ->
|
|||
{client, ClientCookie},
|
||||
{server, ServerCookie}
|
||||
]),
|
||||
Req3 = cowboy_req:reply(200,
|
||||
[{<<"content-type">>, <<"text/html">>}],
|
||||
Body, Req2),
|
||||
{ok, Req3, Opts}.
|
||||
cowboy_req:reply(200, #{
|
||||
<<"content-type">> => <<"text/html">>
|
||||
}, Body, Req2),
|
||||
{ok, Req2, Opts}.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue