mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Merge pull request #1324 from dmathieu/no_error_on_invalid_format
Don't raise an exception if the format isn't recognized
This commit is contained in:
@@ -19,7 +19,7 @@ module ActionController
|
||||
:controller => self.class.name,
|
||||
:action => self.action_name,
|
||||
:params => request.filtered_parameters,
|
||||
:format => request.format.ref,
|
||||
:format => request.format.try(:ref),
|
||||
:method => request.method,
|
||||
:path => (request.fullpath rescue "unknown")
|
||||
}
|
||||
|
||||
@@ -498,6 +498,12 @@ class RespondToControllerTest < ActionController::TestCase
|
||||
assert_equal '<html><div id="iphone">Hello iPhone future from iPhone!</div></html>', @response.body
|
||||
assert_equal "text/html", @response.content_type
|
||||
end
|
||||
|
||||
def test_invalid_format
|
||||
get :using_defaults, :format => "invalidformat"
|
||||
assert_equal " ", @response.body
|
||||
assert_equal "text/html", @response.content_type
|
||||
end
|
||||
end
|
||||
|
||||
class RespondWithController < ActionController::Base
|
||||
|
||||
Reference in New Issue
Block a user