mirror of
https://github.com/github/rails.git
synced 2026-01-27 15:28:00 -05:00
RackResponse should not contain Status header
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user