diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-01-22 11:29:59 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-01-22 11:36:04 +0000 |
commit | b20b0023d6f4676a6f0645a522656b384446562a (patch) | |
tree | db41ad12334f9484220fce2b3d62b1ae0a78dbc0 /test/spec_lint.rb | |
parent | 0cba6a4d5aeb1ac8768b6ca36320731487fb596b (diff) | |
download | rack-b20b0023d6f4676a6f0645a522656b384446562a.tar.gz |
lint: avoid TypeError on non-Hash-like response headers lint-headerhash
According to SPEC (and check_headers), Response headers need only respond to #each. Thus, check_hijack_response should rely on Rack::Utils::HeaderHash if it wishes to access the headers in a hash-like fashion.
Diffstat (limited to 'test/spec_lint.rb')
-rw-r--r-- | test/spec_lint.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/spec_lint.rb b/test/spec_lint.rb index f824113f..fb60b7ef 100644 --- a/test/spec_lint.rb +++ b/test/spec_lint.rb @@ -231,6 +231,13 @@ describe Rack::Lint do [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 |