mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Fix example
echo_post example Fix input parameter of `cowboy_req:reply` function.
This commit is contained in:
parent
2a08250499
commit
e0e01136ec
1 changed files with 2 additions and 2 deletions
|
@ -16,13 +16,13 @@ maybe_echo(<<"POST">>, true, Req0) ->
|
|||
Echo = proplists:get_value(<<"echo">>, PostVals),
|
||||
echo(Echo, Req);
|
||||
maybe_echo(<<"POST">>, false, Req) ->
|
||||
cowboy_req:reply(400, [], <<"Missing body.">>, Req);
|
||||
cowboy_req:reply(400, #{}, <<"Missing body.">>, Req);
|
||||
maybe_echo(_, _, Req) ->
|
||||
%% Method not allowed.
|
||||
cowboy_req:reply(405, Req).
|
||||
|
||||
echo(undefined, Req) ->
|
||||
cowboy_req:reply(400, [], <<"Missing echo parameter.">>, Req);
|
||||
cowboy_req:reply(400, #{}, <<"Missing echo parameter.">>, Req);
|
||||
echo(Echo, Req) ->
|
||||
cowboy_req:reply(200, #{
|
||||
<<"content-type">> => <<"text/plain; charset=utf-8">>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue