Skip to content

Commit

Permalink
RackResponse should not contain Status header
Browse files Browse the repository at this point in the history
  • Loading branch information
lifo committed Jul 16, 2008
1 parent 3343eb4 commit 5cc3ea6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/rack_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 13 additions & 3 deletions actionpack/test/controller/rack_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.