aboutsummaryrefslogtreecommitdiffstats
path: root/test/handlers/cookie_set_h.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2022-05-06 14:23:33 +0200
committerLoïc Hoguin <[email protected]>2022-09-12 11:06:38 +0200
commit180ce23aba863d94c17ee0667cad1ed916f56da1 (patch)
treebb1f5224374700ad5de8e8772d396a91f74bd45b /test/handlers/cookie_set_h.erl
parent0724dbf536c22fc978ba0bc96052c65f0edafa69 (diff)
downloadgun-180ce23aba863d94c17ee0667cad1ed916f56da1.tar.gz
gun-180ce23aba863d94c17ee0667cad1ed916f56da1.tar.bz2
gun-180ce23aba863d94c17ee0667cad1ed916f56da1.zip
Update cookie tests against latest WPT
The http-state tests were removed and replaced with tests in HTML pages. I have devised a way to semi- automatically import them and test them. Additional fixes were made following changes in the rfc6265bis draft.
Diffstat (limited to 'test/handlers/cookie_set_h.erl')
-rw-r--r--test/handlers/cookie_set_h.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/handlers/cookie_set_h.erl b/test/handlers/cookie_set_h.erl
index 29ff351..93ad86d 100644
--- a/test/handlers/cookie_set_h.erl
+++ b/test/handlers/cookie_set_h.erl
@@ -33,4 +33,10 @@ set_cookie_list(Req=#{qs := <<"prefix">>}) ->
set_cookie_list(#{qs := <<"secure_http">>}) ->
[<<"secure_from_nonsecure_http=1; Secure; Path=/">>];
set_cookie_list(#{qs := <<"secure_https">>}) ->
- [<<"secure_from_secure_http=1; Secure; Path=/">>].
+ [<<"secure_from_secure_http=1; Secure; Path=/">>];
+set_cookie_list(Req=#{qs := <<"ttb=",_/bits>>}) ->
+ #{ttb := SetCookies} = cowboy_req:match_qs([ttb], Req),
+ case binary_to_term(SetCookies) of
+ List when is_list(List) -> List;
+ Bin -> [Bin]
+ end.