1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

Merge pull request #684 from zype/cookie-samesite-param

Support SameSite attribute in cookies
This commit is contained in:
John Nunemaker 2020-02-19 11:05:23 -05:00 committed by GitHub
commit 90c52e8e60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -1,5 +1,5 @@
class HTTParty::CookieHash < Hash #:nodoc:
CLIENT_COOKIES = %w(path expires domain path secure httponly)
CLIENT_COOKIES = %w(path expires domain path secure httponly samesite)
def add_cookies(value)
case value

View file

@ -79,6 +79,12 @@ RSpec.describe HTTParty::CookieHash do
expect(@s).not_to match(/path=\//)
end
it "should not include SameSite attribute" do
@cookie_hash.add_cookies(samesite: "Strict")
@s = @cookie_hash.to_cookie_string
expect(@s).not_to match(/samesite=Strict/)
end
it "should not include client side only cookies even when attributes use camal case" do
@cookie_hash.add_cookies(Path: "/")
@s = @cookie_hash.to_cookie_string