about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/unicorn/http_response.rb2
-rw-r--r--test/unit/test_response.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb
index 5480b5d..f79e856 100644
--- a/lib/unicorn/http_response.rb
+++ b/lib/unicorn/http_response.rb
@@ -31,7 +31,7 @@ module Unicorn
     # writes the rack_response to socket as an HTTP response
     def self.write(socket, rack_response)
       status, headers, body = rack_response
-      status = HTTP_STATUS_CODES[status]
+      status = HTTP_STATUS_CODES[status.to_i]
       OUT.clear
 
       # Don't bother enforcing duplicate supression, it's a Hash most of
diff --git a/test/unit/test_response.rb b/test/unit/test_response.rb
index 3cb0a41..644a2a7 100644
--- a/test/unit/test_response.rb
+++ b/test/unit/test_response.rb
@@ -18,6 +18,14 @@ class ResponseTest < Test::Unit::TestCase
     assert out.length > 0, "output didn't have data"
   end
 
+  def test_response_string_status
+    out = StringIO.new
+    HttpResponse.write(out,['200', {}, []])
+    assert out.closed?
+    assert out.length > 0, "output didn't have data"
+    assert_equal 1, out.string.split(/\r\n/).grep(/^Status: 200 OK/).size
+  end
+
   def test_response_OFS_set
     old_ofs = $,
     $, = "\f\v"