Skip to content

Commit

Permalink
allow symbol access to cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
Anorlondo448 committed May 1, 2017
1 parent 4b3c224 commit 2e750d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rack/test/cookie_jar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def initialize(cookies = [], default_host = DEFAULT_HOST)
def [](name)
cookies = hash_for(nil)
# TODO: Should be case insensitive
cookies[name] && cookies[name].value
cookies[name.to_s] && cookies[name.to_s].value
end

def []=(name, value)
Expand Down
6 changes: 6 additions & 0 deletions spec/rack/test/cookie_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
expect(jar["abcd"]).to eq(nil)
end

it "allow symbol access" do
jar = Rack::Test::CookieJar.new
jar["value"] = "foo;abc"
jar[:value].should == "foo;abc"
end

it "doesn't send cookies with the wrong domain" do
get "http://www.example.com/cookies/set", "value" => "1"
get "http://www.other.example/cookies/show"
Expand Down

0 comments on commit 2e750d9

Please sign in to comment.