From 3bd4e195dd0f474f70aee68d6b89a9c772667191 Mon Sep 17 00:00:00 2001 From: Andy Gray Date: Wed, 30 Jan 2013 11:44:12 +1300 Subject: [PATCH] Cookies using 'Path' attribute (instead of 'path') are still handled correctly --- lib/httparty/cookie_hash.rb | 2 +- spec/httparty/cookie_hash_spec.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/httparty/cookie_hash.rb b/lib/httparty/cookie_hash.rb index e9ea92d3..a7863cb4 100644 --- a/lib/httparty/cookie_hash.rb +++ b/lib/httparty/cookie_hash.rb @@ -17,6 +17,6 @@ def add_cookies(value) end def to_cookie_string - delete_if { |k, v| CLIENT_COOKIES.include?(k.to_s) }.collect { |k, v| "#{k}=#{v}" }.join("; ") + delete_if { |k, v| CLIENT_COOKIES.include?(k.to_s.downcase) }.collect { |k, v| "#{k}=#{v}" }.join("; ") end end diff --git a/spec/httparty/cookie_hash_spec.rb b/spec/httparty/cookie_hash_spec.rb index 3a754cc8..3ad243bb 100644 --- a/spec/httparty/cookie_hash_spec.rb +++ b/spec/httparty/cookie_hash_spec.rb @@ -66,5 +66,11 @@ @s = @cookie_hash.to_cookie_string @s.should_not match(/path=\//) 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 + @s.should_not match(/Path=\//) + end end end