Skip to content

Commit

Permalink
Merge pull request #188 from mrGrazy/master
Browse files Browse the repository at this point in the history
Some servers return cookies with 'Path' attribute instead of 'path'
  • Loading branch information
greatuserongithub committed Jan 30, 2013
2 parents a320025 + 3bd4e19 commit 783f878
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/httparty/cookie_hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions spec/httparty/cookie_hash_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 783f878

Please sign in to comment.