From 394b4f0bf7f2a4d496ffe69c8e30cff153d69532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 14 Jan 2016 20:00:50 +0100 Subject: Simplify example instructions and fix broken examples Also convert to AsciiDoc while we're at it. --- examples/rest_pastebin/src/toppage_handler.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/rest_pastebin/src') 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 -- cgit v1.2.3