aboutsummaryrefslogtreecommitdiffstats
path: root/examples/echo_get
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-09-20 06:22:51 +0200
committerLoïc Hoguin <[email protected]>2012-09-21 08:54:57 +0200
commit8497c8bbcdcfd8754c500e65557ee09d9bd1bed0 (patch)
tree76abb26e328b916addb95db4778f0666a1a7d4fb /examples/echo_get
parentf6791b008ac8ccaa331bfbae9afb69af5bf36a7a (diff)
downloadcowboy-8497c8bbcdcfd8754c500e65557ee09d9bd1bed0.tar.gz
cowboy-8497c8bbcdcfd8754c500e65557ee09d9bd1bed0.tar.bz2
cowboy-8497c8bbcdcfd8754c500e65557ee09d9bd1bed0.zip
Don't use decode_packet/3 for parsing the request-line
First step in making all methods and header names binaries to get rid of many inconsistencies caused by decode_packet/3. Methods are all binary now. Note that since they are case sensitive, the usual methods become <<"GET">>, <<"POST">> and so on.
Diffstat (limited to 'examples/echo_get')
-rw-r--r--examples/echo_get/src/toppage_handler.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/echo_get/src/toppage_handler.erl b/examples/echo_get/src/toppage_handler.erl
index a8666dc..6d914ec 100644
--- a/examples/echo_get/src/toppage_handler.erl
+++ b/examples/echo_get/src/toppage_handler.erl
@@ -16,9 +16,9 @@ handle(Req, State) ->
{ok, Req4} = echo(Method, Echo, Req3),
{ok, Req4, State}.
-echo('GET', undefined, Req) ->
+echo(<<"GET">>, undefined, Req) ->
cowboy_req:reply(400, [], <<"Missing echo parameter.">>, Req);
-echo('GET', Echo, Req) ->
+echo(<<"GET">>, Echo, Req) ->
cowboy_req:reply(200,
[{<<"Content-Encoding">>, <<"utf-8">>}], Echo, Req);
echo(_, _, Req) ->