Repository navigation
feat(Negotiation): check ext URIs, and let a parameterised alternate win (#566) - #572
Merged
Merged
Conversation
…win (#566) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5G6PMx5cf5KQSi9sQ4tu1
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
Closes #566 (item O4 of gardeneria#1263, tracked in #570).
Negotiation.Options.extensions(additive). It lists the extension URIs the api supports, asMiddleware'sextensionsoption does. When it is given, a JSON:API instance whoseextnames an unlisted URI is not clean: a read with no clean instance left is406(NOT_ACCEPTABLE), and a write is415(UNSUPPORTED_MEDIA_TYPE), per JSON:API §5. When it is omitted, nothing changes (noextURI is checked), so a host that already negotiates Atomic throughNegotiationdoesn't start answering 415. The check isMiddleware's own:parametersAreAcceptablemoved tosrc/internal/media.ts, and both modules import it from there.Acceptentry with a parameter other thanext/profilecounted as unclean, sotext/markdown;charset=utf-8could never win its alternate's path and fell back to HTML.markdownflag.Verdict.representationalready names the winning alternate ("text/markdown"), as Negotiation.make: no extensions option, and a parameterised alternate never wins (gardeneria#1263 O4) #566 explains.Verification
pnpm install --frozen-lockfile: passvp run build: passvp check: pass. Per-rule lint counts on the four changed files are identical to trunk.vp run check: passvp run -r test:unit: pass, including the newextensions (#566)block and the parameterised-alternate casevp run docgen: passvp run test:coverage, thenfallow audit --base origin/trunk: passChangeset
.changeset/negotiation-extensions.md, minor (a new option, plus the alternate fix)Notes
extensionsset,Negotiationagrees withMiddleware's §5 check on the same header.prefer-option-over-nulldisable comment as its siblingonExplicitRefusal: AGENTS.md requires the?: T | undefinedspelling.Generated by Claude Code