0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-16 05:00:24 +00:00

Add initial req suite

This commit is contained in:
Loïc Hoguin 2016-06-20 17:31:31 +02:00
parent 26c75b57b1
commit d9cad866f2
2 changed files with 160 additions and 1 deletions

View file

@ -11,6 +11,9 @@ echo(What, Req, Opts) ->
F = binary_to_atom(What, latin1),
Value = case cowboy_req:F(Req) of
V when is_integer(V) -> integer_to_binary(V);
V when is_atom(V) -> atom_to_binary(V, latin1);
V when is_list(V); is_tuple(V) -> io_lib:format("~p", [V]);
V -> V
end,
{ok, cowboy_req:reply(200, #{}, Value, Req), Opts}.
cowboy_req:reply(200, #{}, Value, Req),
{ok, Req, Opts}.