From 9f5a1803da64978dfbadbd6629c41bb16fc6ec90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 5 Sep 2017 15:28:11 +0200 Subject: Add tests for direct Req access --- test/handlers/echo_h.erl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test/handlers/echo_h.erl') diff --git a/test/handlers/echo_h.erl b/test/handlers/echo_h.erl index 5042ca8..b7a407b 100644 --- a/test/handlers/echo_h.erl +++ b/test/handlers/echo_h.erl @@ -55,8 +55,11 @@ echo(<<"match">>, Req, Opts) -> end, {ok, cowboy_req:reply(200, #{}, value_to_iodata(Value), Req), Opts}; echo(What, Req, Opts) -> - F = binary_to_atom(What, latin1), - Value = cowboy_req:F(Req), + Key = binary_to_atom(What, latin1), + Value = case cowboy_req:path(Req) of + <<"/direct/",_/bits>> -> maps:get(Key, Req); + _ -> cowboy_req:Key(Req) + end, {ok, cowboy_req:reply(200, #{}, value_to_iodata(Value), Req), Opts}. echo_arg(Arg0, Req, Opts) -> -- cgit v1.2.3