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

don't raise an exception if the format isn't recognized

Fixed while traveling to heuruko
This commit is contained in:
dmathieu 2011-05-26 08:09:38 +02:00
parent ee46bb73d4
commit 16571f9c42
2 changed files with 7 additions and 1 deletions

View file

@ -19,7 +19,7 @@ module ActionController
:controller => self.class.name, :controller => self.class.name,
:action => self.action_name, :action => self.action_name,
:params => request.filtered_parameters, :params => request.filtered_parameters,
:format => request.format.ref, :format => request.format.try(:ref),
:method => request.method, :method => request.method,
:path => (request.fullpath rescue "unknown") :path => (request.fullpath rescue "unknown")
} }

View file

@ -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 '<html><div id="iphone">Hello iPhone future from iPhone!</div></html>', @response.body
assert_equal "text/html", @response.content_type assert_equal "text/html", @response.content_type
end end
def test_invalid_format
get :using_defaults, :format => "invalidformat"
assert_equal " ", @response.body
assert_equal "text/html", @response.content_type
end
end end
class RespondWithController < ActionController::Base class RespondWithController < ActionController::Base