Skip to content

[codex] fix: respect Accept q weights during media negotiation#153

Draft
MicroMilo wants to merge 1 commit into
graphql:mainfrom
MicroMilo:codex/accept-q-weights
Draft

[codex] fix: respect Accept q weights during media negotiation#153
MicroMilo wants to merge 1 commit into
graphql:mainfrom
MicroMilo:codex/accept-q-weights

Conversation

@MicroMilo

Copy link
Copy Markdown

Summary

Fixes #152.

This updates response media type negotiation in createHandler to parse Accept header q weights before selecting a supported response type. Media ranges with q=0 are now skipped, missing q still defaults to 1, 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 --run
  • node .yarn/releases/yarn-4.0.2.cjs check:type
  • node .yarn/releases/yarn-4.0.2.cjs check:lint
  • node .yarn/releases/yarn-4.0.2.cjs check:format

I also tried npx -y node@20 .yarn/releases/yarn-4.0.2.cjs test --run; tests/use.test.ts no longer hits the local Node 25 uWebSockets.js incompatibility under Node 20, but the full suite still has existing environment-sensitive snapshot mismatches in tests/client.test.ts (Headers internal representation) and tests/audits.test.ts (html-validator adds a version field).

@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accept q weights are ignored during response media type negotiation

1 participant