Skip to content

Commit

Permalink
[#24] Changed s/eco/echo
Browse files Browse the repository at this point in the history
  • Loading branch information
davecaos committed Jun 30, 2015
1 parent 2034741 commit 894a44a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ http://localhost:8080/index.html
```

Eco example
You can set a response on the server with PUT
You can set a response on the server with PUT http://localhost:8080/message/echo
```
curl -v -H "Content-Type: text/plain" -X PUT http://localhost:8080/message/yahooooo!!!
HTTP/1.1 200 OK
Expand Down
4 changes: 2 additions & 2 deletions example/src/example_echo_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ allowed_methods(Req, State) ->
%% internal
handle_get(Req, State) ->
Eco = application:get_env(example, echo, ""),
Body = [<<"You Get a eco! ">> , Eco ],
Body = [<<"You Get a echo! ">> , Eco ],
{Body, Req, State}.

handle_put(Req, State) ->
{Eco, Req1} = cowboy_req:binding(echo, Req, ""),
application:set_env(example, echo, Eco),
Body = [<<"You put a eco! ">> , Eco ],
Body = [<<"You put a echo! ">> , Eco ],
Req2 = cowboy_req:set_resp_body(Body, Req1),
{true, Req2, State}.

0 comments on commit 894a44a

Please sign in to comment.