aboutsummaryrefslogtreecommitdiffstats
path: root/examples/chunked_hello_world/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/chunked_hello_world/src')
-rw-r--r--examples/chunked_hello_world/src/chunked_hello_world_app.erl6
-rw-r--r--examples/chunked_hello_world/src/toppage_handler.erl10
2 files changed, 8 insertions, 8 deletions
diff --git a/examples/chunked_hello_world/src/chunked_hello_world_app.erl b/examples/chunked_hello_world/src/chunked_hello_world_app.erl
index 0032d01..fe66908 100644
--- a/examples/chunked_hello_world/src/chunked_hello_world_app.erl
+++ b/examples/chunked_hello_world/src/chunked_hello_world_app.erl
@@ -16,9 +16,9 @@ start(_Type, _Args) ->
{"/", toppage_handler, []}
]}
]),
- {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
- {env, [{dispatch, Dispatch}]}
- ]),
+ {ok, _} = cowboy:start_clear(http, 100, [{port, 8080}], #{
+ env => #{dispatch => Dispatch}
+ }),
chunked_hello_world_sup:start_link().
stop(_State) ->
diff --git a/examples/chunked_hello_world/src/toppage_handler.erl b/examples/chunked_hello_world/src/toppage_handler.erl
index cb1d130..22e52b9 100644
--- a/examples/chunked_hello_world/src/toppage_handler.erl
+++ b/examples/chunked_hello_world/src/toppage_handler.erl
@@ -6,10 +6,10 @@
-export([init/2]).
init(Req, Opts) ->
- Req2 = cowboy_req:chunked_reply(200, Req),
- cowboy_req:chunk("Hello\r\n", Req2),
+ cowboy_req:chunked_reply(200, Req),
+ cowboy_req:chunk("Hello\r\n", Req),
timer:sleep(1000),
- cowboy_req:chunk("World\r\n", Req2),
+ cowboy_req:chunk("World\r\n", Req),
timer:sleep(1000),
- cowboy_req:chunk("Chunked!\r\n", Req2),
- {ok, Req2, Opts}.
+ cowboy_req:chunk("Chunked!\r\n", Req),
+ {ok, Req, Opts}.