[codex] fix: respect Accept q weights during media negotiation#153
Draft
MicroMilo wants to merge 1 commit into
Draft
[codex] fix: respect Accept q weights during media negotiation#153MicroMilo wants to merge 1 commit into
MicroMilo wants to merge 1 commit into
Conversation
|
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.
Summary
Fixes #152.
This updates response media type negotiation in
createHandlerto parseAcceptheaderqweights before selecting a supported response type. Media ranges withq=0are now skipped, missingqstill defaults to1, and when more than one supported type is acceptable the handler keeps the highest-weight candidate while preserving header order for ties.Tests
node .yarn/releases/yarn-4.0.2.cjs test tests/handler.test.ts --runnode .yarn/releases/yarn-4.0.2.cjs check:typenode .yarn/releases/yarn-4.0.2.cjs check:lintnode .yarn/releases/yarn-4.0.2.cjs check:formatI also tried
npx -y node@20 .yarn/releases/yarn-4.0.2.cjs test --run;tests/use.test.tsno longer hits the local Node 25uWebSockets.jsincompatibility under Node 20, but the full suite still has existing environment-sensitive snapshot mismatches intests/client.test.ts(Headersinternal representation) andtests/audits.test.ts(html-validatoradds aversionfield).