diff options
author | Loïc Hoguin <[email protected]> | 2015-08-26 19:24:20 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-08-26 19:24:20 +0200 |
commit | da64723955614e89e3dc3e1275f0871b4182e7f5 (patch) | |
tree | c40d574acfe0e51a6cc124a7e2e2b57022de0899 | |
parent | 073664d2d537693f555a483d5698d2309effed16 (diff) | |
parent | f9a630232f534ce295f4b5eeca8b0124cdb6170e (diff) | |
download | cowlib-da64723955614e89e3dc3e1275f0871b4182e7f5.tar.gz cowlib-da64723955614e89e3dc3e1275f0871b4182e7f5.tar.bz2 cowlib-da64723955614e89e3dc3e1275f0871b4182e7f5.zip |
Merge branch 'cookie-opts-default-values' of https://github.com/KrzysiekJ/cowlib
-rw-r--r-- | src/cow_cookie.erl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cow_cookie.erl b/src/cow_cookie.erl index 150efeb..b31a528 100644 --- a/src/cow_cookie.erl +++ b/src/cow_cookie.erl @@ -197,10 +197,12 @@ setcookie(Name, Value, Opts) -> end, SecureBin = case lists:keyfind(secure, 1, Opts) of false -> <<>>; + {_, false} -> <<>>; {_, true} -> <<"; Secure">> end, HttpOnlyBin = case lists:keyfind(http_only, 1, Opts) of false -> <<>>; + {_, false} -> <<>>; {_, true} -> <<"; HttpOnly">> end, [Name, <<"=">>, Value, <<"; Version=1">>, @@ -218,6 +220,12 @@ setcookie_test_() -> [{path, <<"/acme">>}], <<"Customer=WILE_E_COYOTE; Version=1; Path=/acme">>}, {<<"Customer">>, <<"WILE_E_COYOTE">>, + [{secure, true}], + <<"Customer=WILE_E_COYOTE; Version=1; Secure">>}, + {<<"Customer">>, <<"WILE_E_COYOTE">>, + [{secure, false}, {http_only, false}], + <<"Customer=WILE_E_COYOTE; Version=1">>}, + {<<"Customer">>, <<"WILE_E_COYOTE">>, [{path, <<"/acme">>}, {badoption, <<"negatory">>}], <<"Customer=WILE_E_COYOTE; Version=1; Path=/acme">>} ], |