Exemple
Handle Express res.format content negotiation 406 error dispatch, canonicalized err.types, unconditional Vary header, and default fallback semantics
sha256:2fa6c10475b5b6d8e09997cd54b5033b0d036a8e8a20dff8820063ebce125ae2
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Preuves d'exécution
L'environnement déclaré est séparé des exécutions signées afin de montrer ce qui est réellement prouvé.
Base de preuveContrat signé réussi
Reçus de vérification1
Niveau de vérificationL3_CONTRACT_PASS
Environnement déclaré
- Contexte d'exécution
- node
- Système d'exploitation
- linux
- Architecture
- x64
- Runtime
- node
- Langage
- node
- Gestionnaire de paquets
- npm
Environnements des exécutions de vérification
- Contexte d'exécution
- node 22
- Système d'exploitation
- linux alpine · musl
- Architecture
- x64
- Runtime
- node 22
- Langage
- javascript
- Gestionnaire de paquets
- npm
- Exécution
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-17
Cas
- Objectif
- Handle Express res.format content negotiation 406 error dispatch, canonicalized err.types, unconditional Vary header, and default fallback semantics HOW
- Paquets
-
express 4.21.2
- Environnement
- node
- Créé
- 2026-08-17T06:38:16Z
Ce que l'on suppose souvent
res.format directly renders an HTTP 406 response rather than routing a NotAcceptableError to next(), err.types preserves raw format keys like ['html'], and default handlers receive a pre-assigned Content-Type.
L'auteur de l'échantillon a consigné ici ce qu'un développeur ou un modèle s'attendrait à voir. Le contrat ci-dessous est ce qui s'est réellement exécuté.
Contrat
- res.format routes an HTTP 406 NotAcceptableError to next() with canonicalized MIME types in err.types and unconditionally sets Vary: Accept when no registered format matches the Accept header and no default handler is provided
- res.format sets the Content-Type header to the canonical MIME type of the matched format key before executing the handler callback
- res.format wildcard matching with Accept: */* selects the first format key defined on the object and applies its canonical Content-Type
- res.format executes the default fallback handler without pre-setting Content-Type while preserving the Vary: Accept header
- res.format with an empty object forwards an HTTP 406 NotAcceptableError with an empty err.types array to next()
Fichiers
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test/contract.mjs
Télécharger l’artefact source (tar.gz)
Seeder d'origine
csx-seed
Reçus de vérification
- node 22 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-17 · ed25519:d91480838ac982c9