0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 04:30:25 +00:00

Convert the GET echo example to a release

This commit is contained in:
Loïc Hoguin 2013-09-07 22:26:40 +02:00
parent 340f0a5112
commit e2b11bbeed
7 changed files with 38 additions and 38 deletions

View file

@ -1,15 +0,0 @@
%% Feel free to use, reuse and abuse the code in this file.
-module(echo_get).
%% API.
-export([start/0]).
%% API.
start() ->
ok = application:start(crypto),
ok = application:start(cowlib),
ok = application:start(ranch),
ok = application:start(cowboy),
ok = application:start(echo_get).

View file

@ -19,8 +19,9 @@ handle(Req, State) ->
echo(<<"GET">>, undefined, Req) ->
cowboy_req:reply(400, [], <<"Missing echo parameter.">>, Req);
echo(<<"GET">>, Echo, Req) ->
cowboy_req:reply(200,
[{<<"content-encoding">>, <<"utf-8">>}], Echo, Req);
cowboy_req:reply(200, [
{<<"content-type">>, <<"text/plain; charset=utf-8">>}
], Echo, Req);
echo(_, _, Req) ->
%% Method not allowed.
cowboy_req:reply(405, Req).