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:
commit
5f32221559
2 changed files with 12 additions and 2 deletions
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue