From 0ba3a9a22269d21b2962fec78c03e5671294d20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 22 Jun 2016 13:10:33 +0200 Subject: Add forgotten changes to a test handler --- test/handlers/echo_h.erl | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/handlers/echo_h.erl b/test/handlers/echo_h.erl index 802d537..fd45c5f 100644 --- a/test/handlers/echo_h.erl +++ b/test/handlers/echo_h.erl @@ -27,6 +27,15 @@ echo(<<"uri">>, Req, Opts) -> end, cowboy_req:reply(200, #{}, Value, Req), {ok, Req, Opts}; +echo(<<"match">>, Req, Opts) -> + [Type|Fields0] = cowboy_req:path_info(Req), + Fields = [binary_to_atom(F, latin1) || F <- Fields0], + Value = case Type of + <<"qs">> -> cowboy_req:match_qs(Fields, Req); + <<"cookies">> -> cowboy_req:match_cookies(Fields, Req) + end, + cowboy_req:reply(200, #{}, value_to_iodata(Value), Req), + {ok, Req, Opts}; echo(What, Req, Opts) -> F = binary_to_atom(What, latin1), Value = cowboy_req:F(Req), -- cgit v1.2.3