diff options
Diffstat (limited to 'examples/echo_get')
-rw-r--r-- | examples/echo_get/src/toppage_handler.erl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/echo_get/src/toppage_handler.erl b/examples/echo_get/src/toppage_handler.erl index 1187dc6..50c5985 100644 --- a/examples/echo_get/src/toppage_handler.erl +++ b/examples/echo_get/src/toppage_handler.erl @@ -11,10 +11,10 @@ init(_Transport, Req, []) -> {ok, Req, undefined}. handle(Req, State) -> - {Method, Req2} = cowboy_req:method(Req), - {Echo, Req3} = cowboy_req:qs_val(<<"echo">>, Req2), - {ok, Req4} = echo(Method, Echo, Req3), - {ok, Req4, State}. + Method = cowboy_req:method(Req), + #{echo := Echo} = cowboy_req:match_qs(Req, [echo]), + Req2 = echo(Method, Echo, Req), + {ok, Req2, State}. echo(<<"GET">>, undefined, Req) -> cowboy_req:reply(400, [], <<"Missing echo parameter.">>, Req); |