aboutsummaryrefslogtreecommitdiffstats
path: root/examples/rest_pastebin/src/toppage_handler.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-01-14 20:00:50 +0100
committerLoïc Hoguin <[email protected]>2016-01-14 20:00:50 +0100
commit394b4f0bf7f2a4d496ffe69c8e30cff153d69532 (patch)
tree82c3d7634f93596ec42b41050b4130805a359359 /examples/rest_pastebin/src/toppage_handler.erl
parent4023e7f4e429179fd9c2cce4487c33646c6bd327 (diff)
downloadcowboy-394b4f0bf7f2a4d496ffe69c8e30cff153d69532.tar.gz
cowboy-394b4f0bf7f2a4d496ffe69c8e30cff153d69532.tar.bz2
cowboy-394b4f0bf7f2a4d496ffe69c8e30cff153d69532.zip
Simplify example instructions and fix broken examples
Also convert to AsciiDoc while we're at it.
Diffstat (limited to 'examples/rest_pastebin/src/toppage_handler.erl')
-rw-r--r--examples/rest_pastebin/src/toppage_handler.erl6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/rest_pastebin/src/toppage_handler.erl b/examples/rest_pastebin/src/toppage_handler.erl
index 57b9315..324fa4a 100644
--- a/examples/rest_pastebin/src/toppage_handler.erl
+++ b/examples/rest_pastebin/src/toppage_handler.erl
@@ -16,7 +16,7 @@
-export([paste_text/2]).
init(Req, Opts) ->
- random:seed(now()),
+ random:seed(os:timestamp()),
{cowboy_rest, Req, Opts}.
allowed_methods(Req, State) ->
@@ -57,13 +57,13 @@ create_paste(Req, State) ->
paste_html(Req, index) ->
{read_file("index.html"), Req, index};
paste_html(Req, Paste) ->
- #{lang := Lang} = cowboy_req:match_qs([lang], Req),
+ #{lang := Lang} = cowboy_req:match_qs([{lang, [], plain}], Req),
{format_html(Paste, Lang), Req, Paste}.
paste_text(Req, index) ->
{read_file("index.txt"), Req, index};
paste_text(Req, Paste) ->
- #{lang := Lang} = cowboy_req:match_qs([lang], Req),
+ #{lang := Lang} = cowboy_req:match_qs([{lang, [], plain}], Req),
{format_text(Paste, Lang), Req, Paste}.
% Private