feat: add filter to Request::is_valid_http_content_type to allow for custom content types with POST method requests#3320
Merged
jasonbahl merged 5 commits intowp-graphql:developfrom Mar 4, 2025
Conversation
…custom content types with POST method requests
Collaborator
|
Related #3323 |
justlevine
reviewed
Feb 28, 2025
justlevine
previously approved these changes
Mar 3, 2025
Collaborator
justlevine
left a comment
There was a problem hiding this comment.
Other than unnecessary whitespace that leaked, this LGTM.
Ideally I'd want to dogfood this with a matching PR in WPGraphQL Upload just to confirm there's nothing beyond the filter that we're overlooking, but I'm traveling and not sure if/when I'll have time
justlevine
reviewed
Mar 3, 2025
|
Code Climate has analyzed commit 9cec147 and detected 0 issues on this pull request. View more on Code Climate. |
justlevine
reviewed
Mar 4, 2025
| <exclude name="WordPress.WP.Capabilities.Undetermined" /> | ||
|
|
||
| <!-- Include only once we support PHP 8.3 and above --> | ||
| <exclude name="SlevomatCodingStandard.TypeHints.ClassConstantTypeHint" /> |
Collaborator
There was a problem hiding this comment.
@justlevine - Commenting for myself so I remember to update wpgraphql-coding-standards
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…custom content types with POST method requests
What does this implement/fix? Explain your changes.
This adds a filter to the WPGraphQL\Request\is_valid_http_content_type function which would allow someone to control this bool on special occasions. I am using a plugin which uses multipart/form-data as the content type to achieve file uploads. My uploads were failing do to a conditional using this bool down the line. With this filter now I can allow for "multipart/form-data" as a valid content type.
…
Does this close any currently open issues?
I haven't seen anyone with this issue.
Any relevant logs, error output, GraphiQL screenshots, etc?
For anyone else out there I am using this plugin WPGraphQL Upload and am getting this error "HTTP POST requests must have Content-Type: application/json header. Received: multipart/form-data; boundary=----WebKitFormBoundaryVpEsC5PmSqBvXqK5"
Any other comments?
Good work fellow engineers
Where has this been tested?
Operating System: …
Mac OS: 15.2
WordPress Version: …
6.7.2