From 5facf207004a805d0b0836a6605bb02ab5ac77da Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 23 Apr 2009 21:20:03 -0700 Subject: http_response: minor performance gains Avoid creating garbage every time we lookup the status code along with the message. Also, we can use global const arrays for a little extra performance because we only write one-at-a time Looking at MRI 1.8, Array#join with an empty string argument is slightly better because it skips an append for every iteration. --- test/unit/test_response.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/unit/test_response.rb b/test/unit/test_response.rb index 1d47c57..3cb0a41 100644 --- a/test/unit/test_response.rb +++ b/test/unit/test_response.rb @@ -43,7 +43,7 @@ class ResponseTest < Test::Unit::TestCase HttpResponse.write(io, [code, {}, []]) assert io.closed? lines = io.string.split(/\r\n/) - assert_match(/.* #{HTTP_STATUS_CODES[code]}$/, lines.first, + assert_match(/.* Bad Request$/, lines.first, "wrong default reason phrase") end -- cgit v1.2.3-24-ge0c7