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

Merge pull request #27007 from maclover7/jm-fix-26912

Don't error on an empty CONTENT_TYPE
This commit is contained in:
Rafael Mendonça França 2016-11-13 23:08:19 -05:00
commit 5f32221559
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
2 changed files with 12 additions and 2 deletions

View file

@ -29,8 +29,8 @@ module ActionDispatch
content_mime_type && content_mime_type.to_s
end
def has_content_type?
has_header? "CONTENT_TYPE"
def has_content_type? # :nodoc:
get_header "CONTENT_TYPE"
end
# Returns the accepted MIME type for the request.

View file

@ -212,6 +212,16 @@ class ParamsWrapperTest < ActionController::TestCase
)
end
end
def test_handles_empty_content_type
with_default_wrapper_options do
@request.env["CONTENT_TYPE"] = nil
_controller_class.dispatch(:parse, @request, @response)
assert_equal 200, @response.status
assert_equal "", @response.body
end
end
end
class NamespacedParamsWrapperTest < ActionController::TestCase