fix: revive dead FormData Content-Type warning (#6067)#6070
Merged
harrishancock merged 3 commits intomainfrom Feb 13, 2026
Merged
fix: revive dead FormData Content-Type warning (#6067)#6070harrishancock merged 3 commits intomainfrom
harrishancock merged 3 commits intomainfrom
Conversation
harrishancock
commented
Feb 13, 2026
jasnell
reviewed
Feb 13, 2026
jasnell
reviewed
Feb 13, 2026
jasnell
reviewed
Feb 13, 2026
jasnell
approved these changes
Feb 13, 2026
This comment was marked as outdated.
This comment was marked as outdated.
The logWarning() in Body::Body that warns when a FormData body is paired with a custom Content-Type header was dead code. The comparison used ConstMimeType::operator==(kj::StringPtr), which compared the full substring after '/' against the subtype -- so 'form-data; boundary=...' never matched 'form-data'. Fix the comparison by parsing the content-type string into a MimeType first, then comparing against MimeType::FORM_DATA. The MimeType equality operator correctly ignores MIME parameters like boundary. Also remove ConstMimeType::operator==(kj::StringPtr) entirely -- it was a footgun with only this one (buggy) caller, and any future use would hit the same parameter-ignoring trap. Co-Authored-By: Claude <noreply@anthropic.com>
Several logWarning() call sites were guarded by isInspectorEnabled(), which only returns true when the Chrome DevTools inspector is connected. This meant warnings were silently dropped for streaming tail workers and --verbose stderr logging. Add IoContext::hasWarningHandler() that returns true if the inspector, a streaming tail worker tracer, OR --verbose logging is active. Replace all isInspectorEnabled() guards on warning paths with hasWarningHandler(). Co-Authored-By: Claude <noreply@anthropic.com>
Add a two-worker test that exercises several logWarning() code paths and verifies the warnings are visible to a streaming tail worker: - FormData body with a custom Content-Type header (Body::Body) - Null-body status with zero-length body (Response constructor) The "trigger" worker generates warnings in its fetch() handler, invoked via a service binding from its test() entrypoint. The "tail" worker collects streaming tail events and asserts that all expected warning substrings appear within a polling timeout. Co-Authored-By: Claude <noreply@anthropic.com>
783a335 to
56aeaf3
Compare
harrishancock
commented
Feb 13, 2026
jasnell
approved these changes
Feb 13, 2026
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.
The
logWarning()inBody::Bodythat warns when aFormDatabody is paired with a custom Content-Type header was dead code. The comparison usedConstMimeType::operator==(kj::StringPtr), which compared the full substring after '/' against the subtype — so 'form-data; boundary=...' never matched 'form-data'.Fix the comparison by parsing the content-type string into a
MimeTypefirst, then comparing againstMimeType::FORM_DATA. TheMimeTypeequality operator correctly ignores MIME parameters like boundary.Also remove
ConstMimeType::operator==(kj::StringPtr)entirely — it was a footgun with only this one (buggy) caller, and any future use would hit the same parameter-ignoring trap.Add a streaming tail worker test that verifies the warning is emitted and captured in the tracing system when a Request is constructed with a
FormDatabody and a custom Content-Type header.Fixes #6067