aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-08-27 13:28:57 +0200
committerLoïc Hoguin <[email protected]>2012-08-27 13:28:57 +0200
commitd3dcaf109b225b1384fad5b17dbae9c4888c40ea (patch)
tree171cabef2c5aec776631d7a5d14ab687c563e38b /test
parent9e2622becb4d1a37d410f484a14ef32101e560ab (diff)
downloadcowboy-d3dcaf109b225b1384fad5b17dbae9c4888c40ea.tar.gz
cowboy-d3dcaf109b225b1384fad5b17dbae9c4888c40ea.tar.bz2
cowboy-d3dcaf109b225b1384fad5b17dbae9c4888c40ea.zip
Rename cowboy_http_req to cowboy_req
Diffstat (limited to 'test')
-rw-r--r--test/chunked_handler.erl6
-rw-r--r--test/http_SUITE.erl8
-rw-r--r--test/http_handler.erl2
-rw-r--r--test/http_handler_echo_body.erl8
-rw-r--r--test/http_handler_errors.erl8
-rw-r--r--test/http_handler_init_shutdown.erl4
-rw-r--r--test/http_handler_long_polling.erl2
-rw-r--r--test/http_handler_loop_timeout.erl2
-rw-r--r--test/http_handler_multipart.erl4
-rw-r--r--test/http_handler_set_resp.erl14
-rw-r--r--test/http_handler_stream_body.erl6
-rw-r--r--test/rest_forbidden_resource.erl2
-rw-r--r--test/rest_resource_etags.erl2
-rw-r--r--test/websocket_echo_handler.erl2
-rw-r--r--test/websocket_handler.erl2
-rw-r--r--test/websocket_handler_init_shutdown.erl2
16 files changed, 37 insertions, 37 deletions
diff --git a/test/chunked_handler.erl b/test/chunked_handler.erl
index d246d51..38305fd 100644
--- a/test/chunked_handler.erl
+++ b/test/chunked_handler.erl
@@ -8,9 +8,9 @@ init({_Transport, http}, Req, _Opts) ->
{ok, Req, undefined}.
handle(Req, State) ->
- {ok, Req2} = cowboy_http_req:chunked_reply(200, Req),
- cowboy_http_req:chunk("chunked_handler\r\n", Req2),
- cowboy_http_req:chunk("works fine!", Req2),
+ {ok, Req2} = cowboy_req:chunked_reply(200, Req),
+ cowboy_req:chunk("chunked_handler\r\n", Req2),
+ cowboy_req:chunk("works fine!", Req2),
{ok, Req2, State}.
terminate(_Req, _State) ->
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl
index a83da34..60cbbe7 100644
--- a/test/http_SUITE.erl
+++ b/test/http_SUITE.erl
@@ -597,13 +597,13 @@ onrequest_reply(Config) ->
%% Hook for the above onrequest tests.
onrequest_hook(Req) ->
- case cowboy_http_req:qs_val(<<"reply">>, Req) of
+ case cowboy_req:qs_val(<<"reply">>, Req) of
{undefined, Req2} ->
- {ok, Req3} = cowboy_http_req:set_resp_header(
+ {ok, Req3} = cowboy_req:set_resp_header(
'Server', <<"Serenity">>, Req2),
Req3;
{_, Req2} ->
- {ok, Req3} = cowboy_http_req:reply(
+ {ok, Req3} = cowboy_req:reply(
200, [], <<"replied!">>, Req2),
Req3
end.
@@ -626,7 +626,7 @@ onresponse_reply(Config) ->
%% Hook for the above onresponse tests.
onresponse_hook(_, Headers, Req) ->
- {ok, Req2} = cowboy_http_req:reply(
+ {ok, Req2} = cowboy_req:reply(
<<"777 Lucky">>, [{<<"x-hook">>, <<"onresponse">>}|Headers], Req),
Req2.
diff --git a/test/http_handler.erl b/test/http_handler.erl
index 76a85d4..e569adb 100644
--- a/test/http_handler.erl
+++ b/test/http_handler.erl
@@ -12,7 +12,7 @@ init({_Transport, http}, Req, Opts) ->
{ok, Req, #state{headers=Headers, body=Body}}.
handle(Req, State=#state{headers=Headers, body=Body}) ->
- {ok, Req2} = cowboy_http_req:reply(200, Headers, Body, Req),
+ {ok, Req2} = cowboy_req:reply(200, Headers, Body, Req),
{ok, Req2, State}.
terminate(_Req, _State) ->
diff --git a/test/http_handler_echo_body.erl b/test/http_handler_echo_body.erl
index b64ae7b..e4b1ee0 100644
--- a/test/http_handler_echo_body.erl
+++ b/test/http_handler_echo_body.erl
@@ -8,11 +8,11 @@ init({_, http}, Req, _) ->
{ok, Req, undefined}.
handle(Req, State) ->
- {true, Req1} = cowboy_http_req:has_body(Req),
- {ok, Body, Req2} = cowboy_http_req:body(Req1),
- {Size, Req3} = cowboy_http_req:body_length(Req2),
+ {true, Req1} = cowboy_req:has_body(Req),
+ {ok, Body, Req2} = cowboy_req:body(Req1),
+ {Size, Req3} = cowboy_req:body_length(Req2),
Size = byte_size(Body),
- {ok, Req4} = cowboy_http_req:reply(200, [], Body, Req3),
+ {ok, Req4} = cowboy_req:reply(200, [], Body, Req3),
{ok, Req4, State}.
terminate(_, _) ->
diff --git a/test/http_handler_errors.erl b/test/http_handler_errors.erl
index 1c23207..30cbaeb 100644
--- a/test/http_handler_errors.erl
+++ b/test/http_handler_errors.erl
@@ -5,18 +5,18 @@
-export([init/3, handle/2, terminate/2]).
init({_Transport, http}, Req, _Opts) ->
- {Case, Req1} = cowboy_http_req:qs_val(<<"case">>, Req),
+ {Case, Req1} = cowboy_req:qs_val(<<"case">>, Req),
case_init(Case, Req1).
case_init(<<"init_before_reply">> = Case, _Req) ->
erlang:error(Case);
case_init(<<"init_after_reply">> = Case, Req) ->
- {ok, _Req1} = cowboy_http_req:reply(200, [], "http_handler_crashes", Req),
+ {ok, _Req1} = cowboy_req:reply(200, [], "http_handler_crashes", Req),
erlang:error(Case);
case_init(<<"init_reply_handle_error">> = Case, Req) ->
- {ok, Req1} = cowboy_http_req:reply(200, [], "http_handler_crashes", Req),
+ {ok, Req1} = cowboy_req:reply(200, [], "http_handler_crashes", Req),
{ok, Req1, Case};
case_init(<<"handle_before_reply">> = Case, Req) ->
@@ -33,7 +33,7 @@ handle(_Req, <<"handle_before_reply">> = Case) ->
erlang:error(Case);
handle(Req, <<"handle_after_reply">> = Case) ->
- {ok, _Req1} = cowboy_http_req:reply(200, [], "http_handler_crashes", Req),
+ {ok, _Req1} = cowboy_req:reply(200, [], "http_handler_crashes", Req),
erlang:error(Case).
terminate(_Req, _State) ->
diff --git a/test/http_handler_init_shutdown.erl b/test/http_handler_init_shutdown.erl
index ac63b44..c26fa97 100644
--- a/test/http_handler_init_shutdown.erl
+++ b/test/http_handler_init_shutdown.erl
@@ -5,12 +5,12 @@
-export([init/3, handle/2, terminate/2]).
init({_Transport, http}, Req, _Opts) ->
- {ok, Req2} = cowboy_http_req:reply(<<"666 Init Shutdown Testing">>,
+ {ok, Req2} = cowboy_req:reply(<<"666 Init Shutdown Testing">>,
[{'Connection', <<"close">>}], Req),
{shutdown, Req2, undefined}.
handle(Req, State) ->
- {ok, Req2} = cowboy_http_req:reply(200, [], "Hello world!", Req),
+ {ok, Req2} = cowboy_req:reply(200, [], "Hello world!", Req),
{ok, Req2, State}.
terminate(_Req, _State) ->
diff --git a/test/http_handler_long_polling.erl b/test/http_handler_long_polling.erl
index 8d08265..d61d697 100644
--- a/test/http_handler_long_polling.erl
+++ b/test/http_handler_long_polling.erl
@@ -12,7 +12,7 @@ handle(_Req, _State) ->
exit(badarg).
info(timeout, Req, 0) ->
- {ok, Req2} = cowboy_http_req:reply(102, Req),
+ {ok, Req2} = cowboy_req:reply(102, Req),
{ok, Req2, 0};
info(timeout, Req, State) ->
erlang:send_after(500, self(), timeout),
diff --git a/test/http_handler_loop_timeout.erl b/test/http_handler_loop_timeout.erl
index 0e8c78f..c9bb15f 100644
--- a/test/http_handler_loop_timeout.erl
+++ b/test/http_handler_loop_timeout.erl
@@ -9,7 +9,7 @@ init({_, http}, Req, _) ->
{loop, Req, undefined, 500, hibernate}.
info(error_timeout, Req, State) ->
- {ok, Req2} = cowboy_http_req:reply(500, Req),
+ {ok, Req2} = cowboy_req:reply(500, Req),
{ok, Req2, State}.
terminate(_, _) ->
diff --git a/test/http_handler_multipart.erl b/test/http_handler_multipart.erl
index f5f7919..ad5d27e 100644
--- a/test/http_handler_multipart.erl
+++ b/test/http_handler_multipart.erl
@@ -9,14 +9,14 @@ init({_Transport, http}, Req, []) ->
handle(Req, State) ->
{Result, Req2} = acc_multipart(Req, []),
- {ok, Req3} = cowboy_http_req:reply(200, [], term_to_binary(Result), Req2),
+ {ok, Req3} = cowboy_req:reply(200, [], term_to_binary(Result), Req2),
{ok, Req3, State}.
terminate(_Req, _State) ->
ok.
acc_multipart(Req, Acc) ->
- {Result, Req2} = cowboy_http_req:multipart_data(Req),
+ {Result, Req2} = cowboy_req:multipart_data(Req),
acc_multipart(Req2, Acc, Result).
acc_multipart(Req, Acc, {headers, Headers}) ->
diff --git a/test/http_handler_set_resp.erl b/test/http_handler_set_resp.erl
index 83d48c0..db22168 100644
--- a/test/http_handler_set_resp.erl
+++ b/test/http_handler_set_resp.erl
@@ -8,23 +8,23 @@ init({_Transport, http}, Req, Opts) ->
Headers = proplists:get_value(headers, Opts, []),
Body = proplists:get_value(body, Opts, <<"http_handler_set_resp">>),
{ok, Req2} = lists:foldl(fun({Name, Value}, {ok, R}) ->
- cowboy_http_req:set_resp_header(Name, Value, R)
+ cowboy_req:set_resp_header(Name, Value, R)
end, {ok, Req}, Headers),
- {ok, Req3} = cowboy_http_req:set_resp_body(Body, Req2),
- {ok, Req4} = cowboy_http_req:set_resp_header(
+ {ok, Req3} = cowboy_req:set_resp_body(Body, Req2),
+ {ok, Req4} = cowboy_req:set_resp_header(
<<"X-Cowboy-Test">>, <<"ok">>, Req3),
- {ok, Req5} = cowboy_http_req:set_resp_cookie(
+ {ok, Req5} = cowboy_req:set_resp_cookie(
<<"cake">>, <<"lie">>, [], Req4),
{ok, Req5, undefined}.
handle(Req, State) ->
- case cowboy_http_req:has_resp_header(<<"X-Cowboy-Test">>, Req) of
+ case cowboy_req:has_resp_header(<<"X-Cowboy-Test">>, Req) of
false -> {ok, Req, State};
true ->
- case cowboy_http_req:has_resp_body(Req) of
+ case cowboy_req:has_resp_body(Req) of
false -> {ok, Req, State};
true ->
- {ok, Req2} = cowboy_http_req:reply(200, Req),
+ {ok, Req2} = cowboy_req:reply(200, Req),
{ok, Req2, State}
end
end.
diff --git a/test/http_handler_stream_body.erl b/test/http_handler_stream_body.erl
index c90f746..13221eb 100644
--- a/test/http_handler_stream_body.erl
+++ b/test/http_handler_stream_body.erl
@@ -13,11 +13,11 @@ init({_Transport, http}, Req, Opts) ->
{ok, Req, #state{headers=Headers, body=Body, reply=Reply}}.
handle(Req, State=#state{headers=_Headers, body=Body, reply=set_resp}) ->
- {ok, Transport, Socket} = cowboy_http_req:transport(Req),
+ {ok, Transport, Socket} = cowboy_req:transport(Req),
SFun = fun() -> Transport:send(Socket, Body), sent end,
SLen = iolist_size(Body),
- {ok, Req2} = cowboy_http_req:set_resp_body_fun(SLen, SFun, Req),
- {ok, Req3} = cowboy_http_req:reply(200, Req2),
+ {ok, Req2} = cowboy_req:set_resp_body_fun(SLen, SFun, Req),
+ {ok, Req3} = cowboy_req:reply(200, Req2),
{ok, Req3, State}.
terminate(_Req, _State) ->
diff --git a/test/rest_forbidden_resource.erl b/test/rest_forbidden_resource.erl
index 90dee84..eef04d0 100644
--- a/test/rest_forbidden_resource.erl
+++ b/test/rest_forbidden_resource.erl
@@ -27,7 +27,7 @@ post_is_create(Req, State) ->
{true, Req, State}.
create_path(Req, State) ->
- {Path, Req2} = cowboy_http_req:raw_path(Req),
+ {Path, Req2} = cowboy_req:raw_path(Req),
{Path, Req2, State}.
to_text(Req, State) ->
diff --git a/test/rest_resource_etags.erl b/test/rest_resource_etags.erl
index b21aa9f..17b5eb6 100644
--- a/test/rest_resource_etags.erl
+++ b/test/rest_resource_etags.erl
@@ -5,7 +5,7 @@ init(_Transport, _Req, _Opts) ->
{upgrade, protocol, cowboy_http_rest}.
generate_etag(Req, State) ->
- case cowboy_http_req:qs_val(<<"type">>, Req) of
+ case cowboy_req:qs_val(<<"type">>, Req) of
%% Correct return values from generate_etag/2.
{<<"tuple-weak">>, Req2} ->
{{weak, <<"etag-header-value">>}, Req2, State};
diff --git a/test/websocket_echo_handler.erl b/test/websocket_echo_handler.erl
index f5905c8..949e8a6 100644
--- a/test/websocket_echo_handler.erl
+++ b/test/websocket_echo_handler.erl
@@ -17,7 +17,7 @@ terminate(_Req, _State) ->
exit(badarg).
websocket_init(_TransportName, Req, _Opts) ->
- Req2 = cowboy_http_req:compact(Req),
+ Req2 = cowboy_req:compact(Req),
{ok, Req2, undefined}.
websocket_handle({text, Data}, Req, State) ->
diff --git a/test/websocket_handler.erl b/test/websocket_handler.erl
index 5a484a0..1430890 100644
--- a/test/websocket_handler.erl
+++ b/test/websocket_handler.erl
@@ -18,7 +18,7 @@ terminate(_Req, _State) ->
websocket_init(_TransportName, Req, _Opts) ->
erlang:start_timer(1000, self(), <<"websocket_init">>),
- Req2 = cowboy_http_req:compact(Req),
+ Req2 = cowboy_req:compact(Req),
{ok, Req2, undefined}.
websocket_handle({text, Data}, Req, State) ->
diff --git a/test/websocket_handler_init_shutdown.erl b/test/websocket_handler_init_shutdown.erl
index 9d6c475..371c34b 100644
--- a/test/websocket_handler_init_shutdown.erl
+++ b/test/websocket_handler_init_shutdown.erl
@@ -17,7 +17,7 @@ terminate(_Req, _State) ->
exit(badarg).
websocket_init(_TransportName, Req, _Opts) ->
- {ok, Req2} = cowboy_http_req:reply(403, Req),
+ {ok, Req2} = cowboy_req:reply(403, Req),
{shutdown, Req2}.
websocket_handle(_Frame, _Req, _State) ->