diff options
author | Loïc Hoguin <[email protected]> | 2016-08-10 17:15:02 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-08-10 17:15:02 +0200 |
commit | e30d120bd8c9a4a7b469937d5b5be6a8dfe148d4 (patch) | |
tree | 5eb48865b2ad61d3c05bdc0e3e1f639a6b966ffe /examples/cookie | |
parent | aa6f2ab5a48d90e47648dfb53e0894dcaa6f6aac (diff) | |
download | cowboy-e30d120bd8c9a4a7b469937d5b5be6a8dfe148d4.tar.gz cowboy-e30d120bd8c9a4a7b469937d5b5be6a8dfe148d4.tar.bz2 cowboy-e30d120bd8c9a4a7b469937d5b5be6a8dfe148d4.zip |
Make reply functions return Req
Diffstat (limited to 'examples/cookie')
-rw-r--r-- | examples/cookie/src/toppage_handler.erl | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/cookie/src/toppage_handler.erl b/examples/cookie/src/toppage_handler.erl index 6af8dcc..9a67cb1 100644 --- a/examples/cookie/src/toppage_handler.erl +++ b/examples/cookie/src/toppage_handler.erl @@ -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}. |