aboutsummaryrefslogtreecommitdiffstats
path: root/test/http_SUITE.erl
diff options
context:
space:
mode:
authorTom Burdick <[email protected]>2012-10-15 17:56:55 -0500
committerTom Burdick <[email protected]>2013-01-29 11:34:20 -0600
commitc4d1ee554778cc7c90e0a964bfbdddb8823de0c9 (patch)
tree164a3758dbc0f74446974237ab62aad34c20da54 /test/http_SUITE.erl
parentab0699ab29b6750d19cf2e0fce03e185d2206e9d (diff)
downloadcowboy-c4d1ee554778cc7c90e0a964bfbdddb8823de0c9.tar.gz
cowboy-c4d1ee554778cc7c90e0a964bfbdddb8823de0c9.tar.bz2
cowboy-c4d1ee554778cc7c90e0a964bfbdddb8823de0c9.zip
add patch support to cowboy_rest
Diffstat (limited to 'test/http_SUITE.erl')
-rw-r--r--test/http_SUITE.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl
index 25ce595..0029f6f 100644
--- a/test/http_SUITE.erl
+++ b/test/http_SUITE.erl
@@ -56,6 +56,7 @@
-export([rest_missing_get_callbacks/1]).
-export([rest_missing_put_callbacks/1]).
-export([rest_nodelete/1]).
+-export([rest_patch/1]).
-export([rest_resource_etags/1]).
-export([rest_resource_etags_if_none_match/1]).
-export([set_resp_body/1]).
@@ -116,6 +117,7 @@ groups() ->
rest_missing_get_callbacks,
rest_missing_put_callbacks,
rest_nodelete,
+ rest_patch,
rest_resource_etags,
rest_resource_etags_if_none_match,
set_resp_body,
@@ -329,6 +331,7 @@ init_dispatch(Config) ->
{"/missing_get_callbacks", rest_missing_callbacks, []},
{"/missing_put_callbacks", rest_missing_callbacks, []},
{"/nodelete", rest_nodelete_resource, []},
+ {"/patch", rest_patch_resource, []},
{"/resetags", rest_resource_etags, []},
{"/rest_expires", rest_expires, []},
{"/loop_timeout", http_handler_loop_timeout, []},
@@ -832,6 +835,21 @@ rest_nodelete(Config) ->
build_url("/nodelete", Config), Client),
{ok, 500, _, _} = cowboy_client:response(Client2).
+rest_patch(Config) ->
+ Tests = [
+ {204, [{<<"content-type">>, <<"text/plain">>}], <<"whatever">>},
+ {500, [{<<"content-type">>, <<"text/plain">>}], <<"false">>},
+ {400, [{<<"content-type">>, <<"text/plain">>}], <<"halt">>},
+ {415, [{<<"content-type">>, <<"application/json">>}], <<"bad_content_type">>}
+ ],
+ Client = ?config(client, Config),
+ _ = [begin
+ {ok, Client2} = cowboy_client:request(<<"PATCH">>,
+ build_url("/patch", Config), Headers, Body, Client),
+ {ok, Status, _, _} = cowboy_client:response(Client2),
+ ok
+ end || {Status, Headers, Body} <- Tests].
+
rest_resource_get_etag(Config, Type) ->
rest_resource_get_etag(Config, Type, []).