aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-06-22 09:27:29 +0200
committerLoïc Hoguin <[email protected]>2016-06-22 09:27:29 +0200
commit63c7d05eb2be50e5eff15e9444729f11caa2d766 (patch)
treed8fc9f53a2734d8611d3cee99301a9a214f67125
parentbcff1262d03274c4507419ca6339a67f7a57a711 (diff)
downloadcowboy-63c7d05eb2be50e5eff15e9444729f11caa2d766.tar.gz
cowboy-63c7d05eb2be50e5eff15e9444729f11caa2d766.tar.bz2
cowboy-63c7d05eb2be50e5eff15e9444729f11caa2d766.zip
Add tests for cowboy_req: match_cookies and match_qs
-rw-r--r--test/req_SUITE.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/req_SUITE.erl b/test/req_SUITE.erl
index 4d9502f..648ebcd 100644
--- a/test/req_SUITE.erl
+++ b/test/req_SUITE.erl
@@ -109,6 +109,25 @@ host_info(Config) ->
<<"[<<\"localhost\">>]">> = do_get_body("/host_info", Config),
ok.
+match_cookies(Config) ->
+ doc("Matched request cookies."),
+ <<"#{}">> = do_get_body("/match/cookies", [{<<"cookie">>, "a=b; c=d"}], Config),
+ <<"#{a => <<\"b\">>}">> = do_get_body("/match/cookies/a", [{<<"cookie">>, "a=b; c=d"}], Config),
+ <<"#{c => <<\"d\">>}">> = do_get_body("/match/cookies/c", [{<<"cookie">>, "a=b; c=d"}], Config),
+ <<"#{a => <<\"b\">>,c => <<\"d\">>}">> = do_get_body("/match/cookies/a/c",
+ [{<<"cookie">>, "a=b; c=d"}], Config),
+ %% This function is tested more extensively through unit tests.
+ ok.
+
+match_qs(Config) ->
+ doc("Matched request URI query string."),
+ <<"#{}">> = do_get_body("/match/qs?a=b&c=d", Config),
+ <<"#{a => <<\"b\">>}">> = do_get_body("/match/qs/a?a=b&c=d", Config),
+ <<"#{c => <<\"d\">>}">> = do_get_body("/match/qs/c?a=b&c=d", Config),
+ <<"#{a => <<\"b\">>,c => <<\"d\">>}">> = do_get_body("/match/qs/a/c?a=b&c=d", Config),
+ %% This function is tested more extensively through unit tests.
+ ok.
+
method(Config) ->
doc("Request method."),
<<"GET">> = do_body("GET", "/method", Config),