Skip to content

Conversation

@howiezhao
Copy link
Contributor

@howiezhao howiezhao commented Jun 27, 2024

Description

Enhance fixRequestBody method to fix Content-Type includes +json

Motivation and Context

Now, if our Media Type includes +json but does not includes application/json, the fixRequestBody method will not work. For example, the Media Type is application/merge-patch+json.

According to RFC 6838, the + suffix indicates a structured type. Therefore, for the Media Type includes +json, we can directly serialize it to JSON.

This PR fixes the issue where the fixRequestBody method does not work for Media Types includes +json, such as application/merge-patch+json.

How has this been tested?

Unit Test

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@coveralls
Copy link

Coverage Status

coverage: 97.686%. remained the same
when pulling aafb0bd on howiezhao:patch-1
into c8d34f1 on chimurai:master.

@chimurai chimurai changed the title fix(fix-request-body): add fix for '+json' ending fix(fix-request-body): support '+json' content-type suffix Jul 7, 2024
@coveralls
Copy link

Coverage Status

coverage: 97.686%. remained the same
when pulling 830cbce on howiezhao:patch-1
into c8d34f1 on chimurai:master.

@chimurai chimurai merged commit 09d05d5 into chimurai:master Jul 7, 2024
@chimurai
Copy link
Owner

chimurai commented Jul 7, 2024

Thank you so much for your time spent on this improvement; with detailed problem description, reference to RFC spec, creating the solution and accompanied by unit-tests.

This is how you do a PR! 🙏

Thanks @howiezhao!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants