Skip to content

Commit

Permalink
Fix the phantom header key bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
thedarkone committed Sep 22, 2010
1 parent 11e509b commit b937c01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rack/utils.rb
Expand Up @@ -319,7 +319,7 @@ def to_hash
end

def [](k)
super(@names[k] ||= @names[k.downcase])
super(k) || super(@names[k.downcase])
end

def []=(k, v)
Expand Down
6 changes: 6 additions & 0 deletions test/spec_utils.rb
Expand Up @@ -309,6 +309,12 @@
end
end

should "not create headers out of thin air" do
h = Rack::Utils::HeaderHash.new
h['foo']
h['foo'].should.be.nil
h.should.not.include 'foo'
end
end

describe Rack::Utils::Context do
Expand Down

0 comments on commit b937c01

Please sign in to comment.