Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix initializing Response objects with differently-cased Content-Type…

… headers
  • Loading branch information...
commit a36457b5bf50c4bf81187a51b52ac575177814aa 1 parent dda892d
@sstephenson authored
Showing with 7 additions and 2 deletions.
  1. +2 −2 lib/rack/response.rb
  2. +5 −0 test/spec_response.rb
View
4 lib/rack/response.rb
@@ -21,8 +21,8 @@ class Response
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
View
5 test/spec_response.rb
@@ -42,6 +42,11 @@
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
Please sign in to comment.
Something went wrong with that request. Please try again.