diff --git a/lib/httparty/cookie_hash.rb b/lib/httparty/cookie_hash.rb index 7bd65b3..29176dc 100644 --- a/lib/httparty/cookie_hash.rb +++ b/lib/httparty/cookie_hash.rb @@ -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 diff --git a/spec/httparty/cookie_hash_spec.rb b/spec/httparty/cookie_hash_spec.rb index 40db9b1..2309265 100644 --- a/spec/httparty/cookie_hash_spec.rb +++ b/spec/httparty/cookie_hash_spec.rb @@ -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