aboutsummaryrefslogtreecommitdiffstats
path: root/test/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'test/handlers')
-rw-r--r--test/handlers/input_crash_h.erl4
-rw-r--r--test/handlers/long_polling_h.erl7
-rw-r--r--test/handlers/loop_handler_body_h.erl7
-rw-r--r--test/handlers/loop_handler_timeout_h.erl7
4 files changed, 11 insertions, 14 deletions
diff --git a/test/handlers/input_crash_h.erl b/test/handlers/input_crash_h.erl
index 668d053..e941cca 100644
--- a/test/handlers/input_crash_h.erl
+++ b/test/handlers/input_crash_h.erl
@@ -3,8 +3,8 @@
-module(input_crash_h).
--export([init/3]).
+-export([init/2]).
-init(_, Req, content_length) ->
+init(Req, content_length) ->
cowboy_error_h:ignore(cow_http_hd, number, 2),
cowboy_req:parse_header(<<"content-length">>, Req).
diff --git a/test/handlers/long_polling_h.erl b/test/handlers/long_polling_h.erl
index 1c86aed..1b240fd 100644
--- a/test/handlers/long_polling_h.erl
+++ b/test/handlers/long_polling_h.erl
@@ -4,15 +4,14 @@
%% When it receives the last message, it sends a 102 reply back.
-module(long_polling_h).
--behaviour(cowboy_loop_handler).
--export([init/3]).
+-export([init/2]).
-export([info/3]).
-export([terminate/3]).
-init(_, Req, _) ->
+init(Req, _) ->
erlang:send_after(200, self(), timeout),
- {loop, Req, 2, 5000, hibernate}.
+ {long_polling, Req, 2, 5000, hibernate}.
info(timeout, Req, 0) ->
{ok, cowboy_req:reply(102, Req), 0};
diff --git a/test/handlers/loop_handler_body_h.erl b/test/handlers/loop_handler_body_h.erl
index 559ef90..ac75773 100644
--- a/test/handlers/loop_handler_body_h.erl
+++ b/test/handlers/loop_handler_body_h.erl
@@ -4,15 +4,14 @@
%% then sends a 200 reply back.
-module(loop_handler_body_h).
--behaviour(cowboy_loop_handler).
--export([init/3]).
+-export([init/2]).
-export([info/3]).
-export([terminate/3]).
-init(_, Req, _) ->
+init(Req, _) ->
self() ! timeout,
- {loop, Req, undefined, 5000, hibernate}.
+ {long_polling, Req, undefined, 5000, hibernate}.
info(timeout, Req, State) ->
{ok, Body, Req2} = cowboy_req:body(Req),
diff --git a/test/handlers/loop_handler_timeout_h.erl b/test/handlers/loop_handler_timeout_h.erl
index 3b158bf..8e24d33 100644
--- a/test/handlers/loop_handler_timeout_h.erl
+++ b/test/handlers/loop_handler_timeout_h.erl
@@ -5,15 +5,14 @@
%% This results in a 204 reply being sent back by Cowboy.
-module(loop_handler_timeout_h).
--behaviour(cowboy_loop_handler).
--export([init/3]).
+-export([init/2]).
-export([info/3]).
-export([terminate/3]).
-init(_, Req, _) ->
+init(Req, _) ->
erlang:send_after(1000, self(), timeout),
- {loop, Req, undefined, 200, hibernate}.
+ {long_polling, Req, undefined, 200, hibernate}.
info(timeout, Req, State) ->
{ok, cowboy_req:reply(500, Req), State}.