1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

RackResponse should not contain Status header

This commit is contained in:
Pratik Naik 2008-07-16 04:17:28 +01:00
parent 3343eb428c
commit 5cc3ea6969
2 changed files with 14 additions and 4 deletions

View file

@ -250,7 +250,7 @@ end_msg
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,

View file

@ -252,18 +252,28 @@ class RackResponseHeadersTest < BaseRackTest
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