aboutsummaryrefslogtreecommitdiffstats
path: root/test/http_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/http_SUITE.erl')
-rw-r--r--test/http_SUITE.erl45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl
index 4820f89..c90e585 100644
--- a/test/http_SUITE.erl
+++ b/test/http_SUITE.erl
@@ -48,8 +48,12 @@
-export([onresponse_crash/1]).
-export([onresponse_reply/1]).
-export([pipeline/1]).
+-export([rest_bad_accept/1]).
+-export([rest_expires/1]).
-export([rest_keepalive/1]).
-export([rest_keepalive_post/1]).
+-export([rest_missing_get_callbacks/1]).
+-export([rest_missing_put_callbacks/1]).
-export([rest_nodelete/1]).
-export([rest_resource_etags/1]).
-export([rest_resource_etags_if_none_match/1]).
@@ -93,8 +97,12 @@ groups() ->
nc_rand,
nc_zero,
pipeline,
+ rest_bad_accept,
+ rest_expires,
rest_keepalive,
rest_keepalive_post,
+ rest_missing_get_callbacks,
+ rest_missing_put_callbacks,
rest_nodelete,
rest_resource_etags,
rest_resource_etags_if_none_match,
@@ -247,11 +255,15 @@ init_dispatch(Config) ->
{file, <<"test_file.css">>}]},
{[<<"multipart">>], http_handler_multipart, []},
{[<<"echo">>, <<"body">>], http_handler_echo_body, []},
+ {[<<"bad_accept">>], rest_simple_resource, []},
{[<<"simple">>], rest_simple_resource, []},
{[<<"forbidden_post">>], rest_forbidden_resource, [true]},
{[<<"simple_post">>], rest_forbidden_resource, [false]},
+ {[<<"missing_get_callbacks">>], rest_missing_callbacks, []},
+ {[<<"missing_put_callbacks">>], rest_missing_callbacks, []},
{[<<"nodelete">>], rest_nodelete_resource, []},
{[<<"resetags">>], rest_resource_etags, []},
+ {[<<"rest_expires">>], rest_expires, []},
{[<<"loop_timeout">>], http_handler_loop_timeout, []},
{[], http_handler, []}
]}
@@ -354,6 +366,7 @@ The document has moved
{400, "\r\n\r\n\r\n\r\n\r\n\r\n"},
{400, "GET / HTTP/1.1\r\nHost: ninenines.eu\r\n\r\n"},
{400, "GET http://proxy/ HTTP/1.1\r\n\r\n"},
+ {400, "GET / HTTP/1.1\r\nHost: localhost:bad_port\r\n\r\n"},
{505, ResponsePacket},
{408, "GET / HTTP/1.1\r\n"},
{408, "GET / HTTP/1.1\r\nHost: localhost"},
@@ -647,6 +660,24 @@ pipeline(Config) ->
{ok, 200, _, Client11} = cowboy_client:response(Client10),
{error, closed} = cowboy_client:response(Client11).
+rest_bad_accept(Config) ->
+ Client = ?config(client, Config),
+ {ok, Client2} = cowboy_client:request(<<"GET">>,
+ build_url("/bad_accept", Config),
+ [{<<"accept">>, <<"1">>}],
+ Client),
+ {ok, 400, _, _} = cowboy_client:response(Client2).
+
+rest_expires(Config) ->
+ Client = ?config(client, Config),
+ {ok, Client2} = cowboy_client:request(<<"GET">>,
+ build_url("/rest_expires", Config), Client),
+ {ok, 200, RespHeaders, _} = cowboy_client:response(Client2),
+ {_, Expires} = lists:keyfind(<<"expires">>, 1, RespHeaders),
+ {_, LastModified} = lists:keyfind(<<"last-modified">>, 1, RespHeaders),
+ Expires = LastModified = <<"Fri, 21 Sep 2012 22:36:14 GMT">>,
+ ok.
+
rest_keepalive(Config) ->
Client = ?config(client, Config),
URL = build_url("/simple", Config),
@@ -691,6 +722,20 @@ rest_keepalive_post_loop(Config, Client, forbidden_post, N) ->
= lists:keyfind(<<"connection">>, 1, RespHeaders),
rest_keepalive_post_loop(Config, Client3, simple_post, N - 1).
+rest_missing_get_callbacks(Config) ->
+ Client = ?config(client, Config),
+ {ok, Client2} = cowboy_client:request(<<"GET">>,
+ build_url("/missing_get_callbacks", Config), Client),
+ {ok, 500, _, _} = cowboy_client:response(Client2).
+
+rest_missing_put_callbacks(Config) ->
+ Client = ?config(client, Config),
+ {ok, Client2} = cowboy_client:request(<<"PUT">>,
+ build_url("/missing_put_callbacks", Config),
+ [{<<"content-type">>, <<"application/json">>}],
+ <<"{}">>, Client),
+ {ok, 500, _, _} = cowboy_client:response(Client2).
+
rest_nodelete(Config) ->
Client = ?config(client, Config),
{ok, Client2} = cowboy_client:request(<<"DELETE">>,