0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 20:50:24 +00:00

Make reply functions return Req

This commit is contained in:
Loïc Hoguin 2016-08-10 17:15:02 +02:00
parent aa6f2ab5a4
commit e30d120bd8
16 changed files with 109 additions and 108 deletions

View file

@ -5,17 +5,17 @@
-export([init/2]).
init(Req, Opts) ->
init(Req0, Opts) ->
NewValue = integer_to_list(rand:uniform(1000000)),
Req2 = cowboy_req:set_resp_cookie(<<"server">>, NewValue,
#{path => <<"/">>}, Req),
Req1 = cowboy_req:set_resp_cookie(<<"server">>, NewValue,
#{path => <<"/">>}, Req0),
#{client := ClientCookie, server := ServerCookie}
= cowboy_req:match_cookies([{client, [], <<>>}, {server, [], <<>>}], Req2),
{ok, Body} = toppage_dtl:render([
{client, ClientCookie},
{server, ServerCookie}
]),
cowboy_req:reply(200, #{
Req = cowboy_req:reply(200, #{
<<"content-type">> => <<"text/html">>
}, Body, Req2),
{ok, Req2, Opts}.
}, Body, Req1),
{ok, Req1, Opts}.