Permalink
Browse files

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

Fixed while traveling to heuruko
  • Loading branch information...
1 parent ee46bb7 commit 16571f9c42e2717eeb8bf7c915911fa1ca714525 @dmathieu dmathieu committed May 26, 2011
@@ -19,7 +19,7 @@ def process_action(*args)
: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 @@ def test_format_with_custom_response_type_and_request_headers
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

4 comments on commit 16571f9

Member

sikachu replied May 27, 2011

This is an awesome commit. ❤️ ❤️ ❤️

Thank you

Contributor

lardawge replied May 27, 2011

Can this be applied to 3-1-stable... Please...

Member

josevalim replied May 27, 2011

Done.

Contributor

lardawge replied May 27, 2011

Awesome, Thanks!

Please sign in to comment.