From a9f28600e901b11a9222e34bfae8642bfb753186 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 22 Sep 2015 16:20:19 -0700 Subject: don't deal with `nil` values We can know whether or not there is a content type object, and just exit early. There is no need to `try` so hard. --- actionpack/lib/action_controller/metal/params_wrapper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller/metal/params_wrapper.rb') diff --git a/actionpack/lib/action_controller/metal/params_wrapper.rb b/actionpack/lib/action_controller/metal/params_wrapper.rb index e680432127..c38fc40b81 100644 --- a/actionpack/lib/action_controller/metal/params_wrapper.rb +++ b/actionpack/lib/action_controller/metal/params_wrapper.rb @@ -276,7 +276,9 @@ module ActionController # Checks if we should perform parameters wrapping. def _wrapper_enabled? - ref = request.content_mime_type.try(:ref) + return false unless request.has_content_type? + + ref = request.content_mime_type.ref _wrapper_formats.include?(ref) && _wrapper_key && !request.request_parameters[_wrapper_key] end end -- cgit v1.2.3