diff options
author | Jeremy Evans <code@jeremyevans.net> | 2023-06-01 08:55:14 -0700 |
---|---|---|
committer | Eric Wong <bofh@yhbt.net> | 2023-06-05 09:17:18 +0000 |
commit | 9d7bab0bc2211b20806d4d0289a7ea992e49a8a1 (patch) | |
tree | 75973762205d106e2a621d0ed12fbb72fba4aa04 /test/unit/test_server.rb | |
parent | 5299c3f255dada8605c2cffed9eba1b68d9d42b4 (diff) | |
download | unicorn-9d7bab0bc2211b20806d4d0289a7ea992e49a8a1.tar.gz |
Most changes are to the tests to avoid uppercase characters in header keys, which are no longer allowed in rack 3 (to allow for O(1) access). This also changes a few places where an array of headers was used to switch to a hash, as a hash is requierd in Rack 3. Newer versions of curl use a 000 http_code for invalid http codes, so switch from "42 -eq" to "500 -ne" in the test, as Rack::Lint will always raise a 500 error. There is one test that fails on OpenBSD when opening a fifo. This is unrelated to unicorn as far as I can see, so skip the remaining part of the test in that case on OpenBSD. Tests still pass on Rack 2, and presumably Rack 1 as well, though I didn't test Rack 1. Co-authored-by: Eric Wong <bofh@yhbt.net>
Diffstat (limited to 'test/unit/test_server.rb')
-rw-r--r-- | test/unit/test_server.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/unit/test_server.rb b/test/unit/test_server.rb index bc9a222..98e85ab 100644 --- a/test/unit/test_server.rb +++ b/test/unit/test_server.rb @@ -16,7 +16,7 @@ class TestHandler def call(env) while env['rack.input'].read(4096) end - [200, { 'Content-Type' => 'text/plain' }, ['hello!\n']] + [200, { 'content-type' => 'text/plain' }, ['hello!\n']] rescue Unicorn::ClientShutdown, Unicorn::HttpParserError => e $stderr.syswrite("#{e.class}: #{e.message} #{e.backtrace.empty?}\n") raise e @@ -30,7 +30,7 @@ class TestEarlyHintsHandler env['rack.early_hints'].call( "Link" => "</style.css>; rel=preload; as=style\n</script.js>; rel=preload" ) - [200, { 'Content-Type' => 'text/plain' }, ['hello!\n']] + [200, { 'content-type' => 'text/plain' }, ['hello!\n']] end end @@ -45,7 +45,7 @@ class TestRackAfterReply env["rack.after_reply"] << -> { @called = true } - [200, { 'Content-Type' => 'text/plain' }, ["after_reply_called: #{@called}"]] + [200, { 'content-type' => 'text/plain' }, ["after_reply_called: #{@called}"]] rescue Unicorn::ClientShutdown, Unicorn::HttpParserError => e $stderr.syswrite("#{e.class}: #{e.message} #{e.backtrace.empty?}\n") raise e @@ -81,7 +81,7 @@ class WebServerTest < Test::Unit::TestCase tmp.sysseek(0) tmp.truncate(0) tmp.syswrite($$) - lambda { |env| [ 200, { 'Content-Type' => 'text/plain' }, [ "#$$\n" ] ] } + lambda { |env| [ 200, { 'content-type' => 'text/plain' }, [ "#$$\n" ] ] } } redirect_test_io do @server = HttpServer.new(app, :listeners => [ "127.0.0.1:#@port"] ) |