diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/chunked_handler.erl | 4 | ||||
-rw-r--r-- | test/http_handler.erl | 4 | ||||
-rw-r--r-- | test/http_handler_echo_body.erl | 4 | ||||
-rw-r--r-- | test/http_handler_errors.erl | 4 | ||||
-rw-r--r-- | test/http_handler_init_shutdown.erl | 4 | ||||
-rw-r--r-- | test/http_handler_long_polling.erl | 4 | ||||
-rw-r--r-- | test/http_handler_loop_timeout.erl | 4 | ||||
-rw-r--r-- | test/http_handler_multipart.erl | 4 | ||||
-rw-r--r-- | test/http_handler_set_resp.erl | 4 | ||||
-rw-r--r-- | test/http_handler_stream_body.erl | 4 | ||||
-rw-r--r-- | test/websocket_echo_handler.erl | 9 | ||||
-rw-r--r-- | test/websocket_handler.erl | 9 | ||||
-rw-r--r-- | test/websocket_handler_init_shutdown.erl | 9 | ||||
-rw-r--r-- | test/ws_timeout_cancel_handler.erl | 9 | ||||
-rw-r--r-- | test/ws_timeout_hibernate_handler.erl | 9 |
15 files changed, 25 insertions, 60 deletions
diff --git a/test/chunked_handler.erl b/test/chunked_handler.erl index 38305fd..4a43c1a 100644 --- a/test/chunked_handler.erl +++ b/test/chunked_handler.erl @@ -2,7 +2,7 @@ -module(chunked_handler). -behaviour(cowboy_http_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3, handle/2, terminate/3]). init({_Transport, http}, Req, _Opts) -> {ok, Req, undefined}. @@ -13,5 +13,5 @@ handle(Req, State) -> cowboy_req:chunk("works fine!", Req2), {ok, Req2, State}. -terminate(_Req, _State) -> +terminate(_, _, _) -> ok. diff --git a/test/http_handler.erl b/test/http_handler.erl index e569adb..e1f1665 100644 --- a/test/http_handler.erl +++ b/test/http_handler.erl @@ -2,7 +2,7 @@ -module(http_handler). -behaviour(cowboy_http_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3, handle/2, terminate/3]). -record(state, {headers, body}). @@ -15,5 +15,5 @@ handle(Req, State=#state{headers=Headers, body=Body}) -> {ok, Req2} = cowboy_req:reply(200, Headers, Body, Req), {ok, Req2, State}. -terminate(_Req, _State) -> +terminate(_, _, _) -> ok. diff --git a/test/http_handler_echo_body.erl b/test/http_handler_echo_body.erl index 37c2072..31595d5 100644 --- a/test/http_handler_echo_body.erl +++ b/test/http_handler_echo_body.erl @@ -2,7 +2,7 @@ -module(http_handler_echo_body). -behaviour(cowboy_http_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3, handle/2, terminate/3]). init({_, http}, Req, _) -> {ok, Req, undefined}. @@ -15,5 +15,5 @@ handle(Req, State) -> {ok, Req4} = cowboy_req:reply(200, [], Body, Req3), {ok, Req4, State}. -terminate(_, _) -> +terminate(_, _, _) -> ok. diff --git a/test/http_handler_errors.erl b/test/http_handler_errors.erl index 30cbaeb..2d1066c 100644 --- a/test/http_handler_errors.erl +++ b/test/http_handler_errors.erl @@ -2,7 +2,7 @@ -module(http_handler_errors). -behaviour(cowboy_http_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3, handle/2, terminate/3]). init({_Transport, http}, Req, _Opts) -> {Case, Req1} = cowboy_req:qs_val(<<"case">>, Req), @@ -36,5 +36,5 @@ handle(Req, <<"handle_after_reply">> = Case) -> {ok, _Req1} = cowboy_req:reply(200, [], "http_handler_crashes", Req), erlang:error(Case). -terminate(_Req, _State) -> +terminate(_, _, _) -> ok. diff --git a/test/http_handler_init_shutdown.erl b/test/http_handler_init_shutdown.erl index edea1a0..fd01983 100644 --- a/test/http_handler_init_shutdown.erl +++ b/test/http_handler_init_shutdown.erl @@ -2,7 +2,7 @@ -module(http_handler_init_shutdown). -behaviour(cowboy_http_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3, handle/2, terminate/3]). init({_Transport, http}, Req, _Opts) -> {ok, Req2} = cowboy_req:reply(<<"666 Init Shutdown Testing">>, @@ -13,5 +13,5 @@ handle(Req, State) -> {ok, Req2} = cowboy_req:reply(200, [], "Hello world!", Req), {ok, Req2, State}. -terminate(_Req, _State) -> +terminate(_, _, _) -> ok. diff --git a/test/http_handler_long_polling.erl b/test/http_handler_long_polling.erl index d61d697..763e1fe 100644 --- a/test/http_handler_long_polling.erl +++ b/test/http_handler_long_polling.erl @@ -2,7 +2,7 @@ -module(http_handler_long_polling). -behaviour(cowboy_http_handler). --export([init/3, handle/2, info/3, terminate/2]). +-export([init/3, handle/2, info/3, terminate/3]). init({_Transport, http}, Req, _Opts) -> erlang:send_after(500, self(), timeout), @@ -18,5 +18,5 @@ info(timeout, Req, State) -> erlang:send_after(500, self(), timeout), {loop, Req, State - 1, hibernate}. -terminate(_Req, _State) -> +terminate({normal, shutdown}, _, _) -> ok. diff --git a/test/http_handler_loop_timeout.erl b/test/http_handler_loop_timeout.erl index c9bb15f..0155b1e 100644 --- a/test/http_handler_loop_timeout.erl +++ b/test/http_handler_loop_timeout.erl @@ -2,7 +2,7 @@ -module(http_handler_loop_timeout). -behaviour(cowboy_loop_handler). --export([init/3, info/3, terminate/2]). +-export([init/3, info/3, terminate/3]). init({_, http}, Req, _) -> erlang:send_after(1000, self(), error_timeout), @@ -12,5 +12,5 @@ info(error_timeout, Req, State) -> {ok, Req2} = cowboy_req:reply(500, Req), {ok, Req2, State}. -terminate(_, _) -> +terminate({normal, timeout}, _, _) -> ok. diff --git a/test/http_handler_multipart.erl b/test/http_handler_multipart.erl index 850574f..8209535 100644 --- a/test/http_handler_multipart.erl +++ b/test/http_handler_multipart.erl @@ -2,7 +2,7 @@ -module(http_handler_multipart). -behaviour(cowboy_http_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3, handle/2, terminate/3]). init({_Transport, http}, Req, []) -> {ok, Req, {}}. @@ -12,7 +12,7 @@ handle(Req, State) -> {ok, Req3} = cowboy_req:reply(200, [], term_to_binary(Result), Req2), {ok, Req3, State}. -terminate(_Req, _State) -> +terminate(_, _, _) -> ok. acc_multipart(Req) -> diff --git a/test/http_handler_set_resp.erl b/test/http_handler_set_resp.erl index 70ddf79..d00d72a 100644 --- a/test/http_handler_set_resp.erl +++ b/test/http_handler_set_resp.erl @@ -2,7 +2,7 @@ -module(http_handler_set_resp). -behaviour(cowboy_http_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3, handle/2, terminate/3]). init({_Transport, http}, Req, Opts) -> Headers = proplists:get_value(headers, Opts, []), @@ -27,5 +27,5 @@ handle(Req, State) -> end end. -terminate(_Req, _State) -> +terminate(_, _, _) -> ok. diff --git a/test/http_handler_stream_body.erl b/test/http_handler_stream_body.erl index d8f7d91..5e42fa7 100644 --- a/test/http_handler_stream_body.erl +++ b/test/http_handler_stream_body.erl @@ -2,7 +2,7 @@ -module(http_handler_stream_body). -behaviour(cowboy_http_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3, handle/2, terminate/3]). -record(state, {headers, body, reply}). @@ -24,5 +24,5 @@ handle(Req, State=#state{headers=_Headers, body=Body, reply=Reply}) -> {ok, Req3} = cowboy_req:reply(200, Req2), {ok, Req3, State}. -terminate(_Req, _State) -> +terminate(_, _, _) -> ok. diff --git a/test/websocket_echo_handler.erl b/test/websocket_echo_handler.erl index 926b51d..21b0116 100644 --- a/test/websocket_echo_handler.erl +++ b/test/websocket_echo_handler.erl @@ -1,21 +1,14 @@ %% Feel free to use, reuse and abuse the code in this file. -module(websocket_echo_handler). --behaviour(cowboy_http_handler). -behaviour(cowboy_websocket_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3]). -export([websocket_init/3, websocket_handle/3, websocket_info/3, websocket_terminate/3]). init(_Any, _Req, _Opts) -> {upgrade, protocol, cowboy_websocket}. -handle(_Req, _State) -> - exit(badarg). - -terminate(_Req, _State) -> - exit(badarg). - websocket_init(_TransportName, Req, _Opts) -> Req2 = cowboy_req:compact(Req), {ok, Req2, undefined}. diff --git a/test/websocket_handler.erl b/test/websocket_handler.erl index caf4828..a9863ae 100644 --- a/test/websocket_handler.erl +++ b/test/websocket_handler.erl @@ -1,21 +1,14 @@ %% Feel free to use, reuse and abuse the code in this file. -module(websocket_handler). --behaviour(cowboy_http_handler). -behaviour(cowboy_websocket_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3]). -export([websocket_init/3, websocket_handle/3, websocket_info/3, websocket_terminate/3]). init(_Any, _Req, _Opts) -> {upgrade, protocol, cowboy_websocket}. -handle(_Req, _State) -> - exit(badarg). - -terminate(_Req, _State) -> - exit(badarg). - websocket_init(_TransportName, Req, _Opts) -> erlang:start_timer(1000, self(), <<"websocket_init">>), Req2 = cowboy_req:compact(Req), diff --git a/test/websocket_handler_init_shutdown.erl b/test/websocket_handler_init_shutdown.erl index 5fdfba3..7ccea05 100644 --- a/test/websocket_handler_init_shutdown.erl +++ b/test/websocket_handler_init_shutdown.erl @@ -1,21 +1,14 @@ %% Feel free to use, reuse and abuse the code in this file. -module(websocket_handler_init_shutdown). --behaviour(cowboy_http_handler). -behaviour(cowboy_websocket_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3]). -export([websocket_init/3, websocket_handle/3, websocket_info/3, websocket_terminate/3]). init(_Any, _Req, _Opts) -> {upgrade, protocol, cowboy_websocket}. -handle(_Req, _State) -> - exit(badarg). - -terminate(_Req, _State) -> - exit(badarg). - websocket_init(_TransportName, Req, _Opts) -> {ok, Req2} = cowboy_req:reply(403, Req), {shutdown, Req2}. diff --git a/test/ws_timeout_cancel_handler.erl b/test/ws_timeout_cancel_handler.erl index ee75d9b..68b0468 100644 --- a/test/ws_timeout_cancel_handler.erl +++ b/test/ws_timeout_cancel_handler.erl @@ -1,21 +1,14 @@ %% Feel free to use, reuse and abuse the code in this file. -module(ws_timeout_cancel_handler). --behaviour(cowboy_http_handler). -behaviour(cowboy_websocket_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3]). -export([websocket_init/3, websocket_handle/3, websocket_info/3, websocket_terminate/3]). init(_Any, _Req, _Opts) -> {upgrade, protocol, cowboy_websocket}. -handle(_Req, _State) -> - exit(badarg). - -terminate(_Req, _State) -> - exit(badarg). - websocket_init(_TransportName, Req, _Opts) -> erlang:start_timer(500, self(), should_not_cancel_timer), {ok, Req, undefined, 1000}. diff --git a/test/ws_timeout_hibernate_handler.erl b/test/ws_timeout_hibernate_handler.erl index ac6ee4f..41b9edd 100644 --- a/test/ws_timeout_hibernate_handler.erl +++ b/test/ws_timeout_hibernate_handler.erl @@ -1,21 +1,14 @@ %% Feel free to use, reuse and abuse the code in this file. -module(ws_timeout_hibernate_handler). --behaviour(cowboy_http_handler). -behaviour(cowboy_websocket_handler). --export([init/3, handle/2, terminate/2]). +-export([init/3]). -export([websocket_init/3, websocket_handle/3, websocket_info/3, websocket_terminate/3]). init(_Any, _Req, _Opts) -> {upgrade, protocol, cowboy_websocket}. -handle(_Req, _State) -> - exit(badarg). - -terminate(_Req, _State) -> - exit(badarg). - websocket_init(_TransportName, Req, _Opts) -> {ok, Req, undefined, 1000, hibernate}. |