Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'lint-headerhash' of git://bogomips.org/rack

* 'lint-headerhash' of git://bogomips.org/rack:
  lint: avoid TypeError on non-Hash-like response headers
  • Loading branch information...
commit c56fbf46a31037de0c56b838dfd09568b1ee3491 2 parents e1a4c00 + b20b002
James Tucker raggi authored
Showing with 12 additions and 0 deletions.
  1. +5 −0 lib/rack/lint.rb
  2. +7 −0 test/spec_lint.rb
5 lib/rack/lint.rb
View
@@ -500,6 +500,11 @@ def check_hijack(env)
## It is also possible to hijack a response after the status and headers
## have been sent.
def check_hijack_response(headers, env)
+
+ # this check uses headers like a hash, but the spec only requires
+ # headers respond to #each
+ headers = Rack::Utils::HeaderHash.new(headers)
+
## In order to do this, an application may set the special header
## <tt>rack.hijack</tt> to an object that responds to <tt>call</tt>
## accepting an argument that conforms to the <tt>rack.hijack_io</tt>
7 test/spec_lint.rb
View
@@ -231,6 +231,13 @@ def result.name
[200, {"Foo-Bar" => "one\ntwo\nthree", "Content-Length" => "0", "Content-Type" => "text/plain" }, []]
}).call(env({}))
}.should.not.raise(Rack::Lint::LintError)
+
+ # non-Hash header responses should be allowed
+ lambda {
+ Rack::Lint.new(lambda { |env|
+ [200, [%w(Content-Type text/plain), %w(Content-Length 0)], []]
+ }).call(env({}))
+ }.should.not.raise(TypeError)
end
should "notice content-type errors" do
Please sign in to comment.
Something went wrong with that request. Please try again.