mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Add tests for cowboy_req: match_cookies and match_qs
This commit is contained in:
parent
bcff1262d0
commit
63c7d05eb2
1 changed files with 19 additions and 0 deletions
|
@ -109,6 +109,25 @@ host_info(Config) ->
|
||||||
<<"[<<\"localhost\">>]">> = do_get_body("/host_info", Config),
|
<<"[<<\"localhost\">>]">> = do_get_body("/host_info", Config),
|
||||||
ok.
|
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) ->
|
method(Config) ->
|
||||||
doc("Request method."),
|
doc("Request method."),
|
||||||
<<"GET">> = do_body("GET", "/method", Config),
|
<<"GET">> = do_body("GET", "/method", Config),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue