0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-16 05:00:24 +00:00

Fix error response when constraint validation fails

This commit is contained in:
Loïc Hoguin 2017-09-27 16:20:38 +02:00
parent 5fe46ebe64
commit fda2d150db
No known key found for this signature in database
GPG key ID: 71366FF21851DF03
2 changed files with 20 additions and 8 deletions

View file

@ -171,6 +171,9 @@ match_cookies(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),
%% Ensure match errors result in a 400 response.
{400, _, _} = do_get("/match/cookies/a/c",
[{<<"cookie">>, "a=b"}], Config),
%% This function is tested more extensively through unit tests.
ok.
@ -183,6 +186,8 @@ match_qs(Config) ->
<<"#{a => <<\"b\">>,c => <<\"d\">>}">> = do_get_body("/match/qs/a/c?a=b&c=d", Config),
<<"#{a => <<\"b\">>,c => true}">> = do_get_body("/match/qs/a/c?a=b&c", Config),
<<"#{a => true,c => <<\"d\">>}">> = do_get_body("/match/qs/a/c?a&c=d", Config),
%% Ensure match errors result in a 400 response.
{400, _, _} = do_get("/match/qs/a/c?a=b", [], Config),
%% This function is tested more extensively through unit tests.
ok.