Permalink
Browse files

RackResponse should not contain Status header

  • Loading branch information...
1 parent 3343eb4 commit 5cc3ea6969f047a782fa8ac44530baeef597edb3 @lifo lifo committed Jul 16, 2008
Showing with 14 additions and 4 deletions.
  1. +1 −1 actionpack/lib/action_controller/rack_process.rb
  2. +13 −3 actionpack/test/controller/rack_test.rb
@@ -250,7 +250,7 @@ def normalize_headers(options = "text/html")
headers['Content-Language'] = options.delete('language') if options['language']
headers['Expires'] = options.delete('expires') if options['expires']
- @status = options['Status'] || "200 OK"
+ @status = options.delete('Status') || "200 OK"
# Convert 'cookie' header to 'Set-Cookie' headers.
# Because Set-Cookie header can appear more the once in the response body,
@@ -252,18 +252,28 @@ def setup
super
@response = ActionController::RackResponse.new(@request)
@output = StringIO.new('')
- @headers = proc { @response.out(@output)[1] }
+ @response.headers['Status'] = 200
end
def test_content_type
[204, 304].each do |c|
@response.headers['Status'] = c
- assert !@headers.call.has_key?("Content-Type")
+ assert !response_headers.has_key?("Content-Type")
end
[200, 302, 404, 500].each do |c|
@response.headers['Status'] = c
- assert @headers.call.has_key?("Content-Type")
+ assert response_headers.has_key?("Content-Type")
end
end
+
+ def test_status
+ assert !response_headers.has_key?('Status')
+ end
+
+ private
+
+ def response_headers
+ @response.out(@output)[1]
+ end
end

0 comments on commit 5cc3ea6

Please sign in to comment.