mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05: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:
commit
ec08bfc035
2 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue