-
Notifications
You must be signed in to change notification settings - Fork 466
feat: add filter to Request::is_valid_http_content_type to allow for custom content types with POST method requests #3320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…custom content types with POST method requests
|
Related #3323 |
justlevine
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
Code Climate has analyzed commit 9cec147 and detected 0 issues on this pull request. View more on Code Climate. |
| <exclude name="WordPress.WP.Capabilities.Undetermined" /> | ||
|
|
||
| <!-- Include only once we support PHP 8.3 and above --> | ||
| <exclude name="SlevomatCodingStandard.TypeHints.ClassConstantTypeHint" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@justlevine - Commenting for myself so I remember to update wpgraphql-coding-standards
…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