Merge pull request #44608 from MGatner/problem-json

Mime Support for "problem detail"
This commit is contained in:
Aaron Patterson 2022-03-18 16:59:17 -07:00 committed by GitHub
commit 97abaa7157
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

@ -43,7 +43,8 @@
# https://www.ietf.org/rfc/rfc4627.txt
# http://www.json.org/JSONRequest.html
Mime::Type.register "application/json", :json, %w( text/x-json application/jsonrequest )
# https://www.ietf.org/rfc/rfc7807.txt
Mime::Type.register "application/json", :json, %w( text/x-json application/jsonrequest application/problem+json )
Mime::Type.register "application/pdf", :pdf, [], %w(pdf)
Mime::Type.register "application/zip", :zip, [], %w(zip)

@ -39,6 +39,13 @@ def teardown
)
end
test "parses json params for application problem+json" do
assert_parses(
{ "person" => { "name" => "David" } },
"{\"person\": {\"name\": \"David\"}}", "CONTENT_TYPE" => "application/problem+json"
)
end
test "does not parse unregistered media types such as application/vnd.api+json" do
assert_parses(
{},