Repository navigation
Conversation
4 tasks done
Member
|
I prefer your doc PR that fixes the issue with a |
3 of 4 tasks
bcomnes
force-pushed
the
bret/content-type-validation-option
branch
from
August 28, 2026 00:16
0a39db0 to
33bbb37
Compare
Contributor
Author
|
Got this rebased. |
metcoder95
reviewed
Sep 2, 2026
metcoder95
left a comment
Member
There was a problem hiding this comment.
I believe that this should be also doable per route and not only per-context; we are already partially doing so, then the effort must be minimal
| you cannot control. In that mode, RegExp and catch-all content-type parsers can | ||
| match the raw invalid header value. | ||
|
|
||
| Malformed values do not produce a valid `request.mediaType` and therefore do |
Member
There was a problem hiding this comment.
This needs an example to disambiguate how to handle invalid content-types
Signed-off-by: Bret Comnes <bret@comnes.org>
bcomnes
force-pushed
the
bret/content-type-validation-option
branch
from
October 9, 2026 16:22
33bbb37 to
fd80f2a
Compare
Contributor
Author
|
I rebased and fixed up this PR. |
Contributor
Author
|
Closing in favor of #6927 |
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.
I reworked #6918 into an option.
Adds a default-on
strictContentTypeHeaderValidationserver option for applications that must accept known and unknown malformedContent-Typerequest headers from clients they cannot control. It basically adds an option to switchlib/handle-request.jsback to not validating before consulting the array of registered content type header handlers.Behavior
Default behavior is unchanged:
Content-Typeheader values are rejected with415 FST_ERR_CTP_INVALID_MEDIA_TYPEWith
strictContentTypeHeaderValidation: false:request.mediaTypebehavior ("/")schema.body.contentcannot select a narrowed validator for malformed inputChecklist
npm run test && npm run benchmark --if-presentand the Code of conduct