Skip to content

fix: parse JSON body when Content-Type has charset#391

Open
slagiewka wants to merge 2 commits into
apollographql:mainfrom
slagiewka:handle_content_type_extra_charset
Open

fix: parse JSON body when Content-Type has charset#391
slagiewka wants to merge 2 commits into
apollographql:mainfrom
slagiewka:handle_content_type_extra_charset

Conversation

@slagiewka

@slagiewka slagiewka commented Dec 22, 2024

Copy link
Copy Markdown

Or other parameters.

In accordance with RFC 91101, Content-Type contains first and
foremost the media type. It can be followed by key-value pairs of
parameters.

This change supports extracting the media type and effectively
discarding the other parameters as these are currently irrelevant to
body parsing. The result media type is then matched against previously
used JSON type tests.

Closes #229
Closes #341

Footnotes

  1. https://www.rfc-editor.org/rfc/rfc9110.html

@slagiewka slagiewka requested a review from a team as a code owner December 22, 2024 15:24
@apollo-cla

Copy link
Copy Markdown

@slagiewka: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

@codesandbox-ci

codesandbox-ci Bot commented Dec 22, 2024

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@slagiewka slagiewka force-pushed the handle_content_type_extra_charset branch 2 times, most recently from 3eb471b to c6a9eaa Compare December 22, 2024 15:32
@slagiewka

Copy link
Copy Markdown
Author

@trevor-scheer please have a look 🙂

Or other parameters.

In accordance with RFC 9110[^1], Content-Type contains first and
foremost the media type. It can be followed by key-value pairs of
parameters.

This change supports extracting the media type and effectively
discarding the other parameters as these are currently irrelevant to
body parsing. The result media type is then matched against previously
used JSON type tests.

Closes apollographql#229
Closes apollographql#341

[^1]:https://www.rfc-editor.org/rfc/rfc9110.html
@slagiewka slagiewka force-pushed the handle_content_type_extra_charset branch from c6a9eaa to f5378ca Compare December 22, 2024 16:54
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.

JSON body is not parsed when Content-Type contains a charset Refine Content-Type negotiation

2 participants