diff options
author | Sam Stephenson <sam@37signals.com> | 2010-10-28 23:00:52 +0800 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2010-10-28 23:26:46 +0800 |
commit | 3e4833b55d253b7877c078adf59f394e09ec6e99 (patch) | |
tree | cb4f0aee3824b69195d3f23ee3e30e816fb913f0 | |
parent | dda892d60daff0fe7289008a4153fa628dcc8d11 (diff) | |
download | rack-3e4833b55d253b7877c078adf59f394e09ec6e99.tar.gz |
Fix initializing Response objects with differently-cased Content-Type headers
-rw-r--r-- | lib/rack/response.rb | 4 | ||||
-rw-r--r-- | test/spec_response.rb | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/rack/response.rb b/lib/rack/response.rb index 4900283a..32656d62 100644 --- a/lib/rack/response.rb +++ b/lib/rack/response.rb @@ -21,8 +21,8 @@ module Rack def initialize(body=[], status=200, header={}, &block) @status = status.to_i - @header = Utils::HeaderHash.new({"Content-Type" => "text/html"}. - merge(header)) + @header = Utils::HeaderHash.new("Content-Type" => "text/html"). + merge(header) @writer = lambda { |x| @body << x } @block = nil diff --git a/test/spec_response.rb b/test/spec_response.rb index 28121130..c08a62e7 100644 --- a/test/spec_response.rb +++ b/test/spec_response.rb @@ -42,6 +42,11 @@ describe Rack::Response do response["Content-Type"].should.equal "text/plain" end + it "can override the initial Content-Type with a different case" do + response = Rack::Response.new("", 200, "content-type" => "text/plain") + response["Content-Type"].should.equal "text/plain" + end + it "can set cookies" do response = Rack::Response.new |