Пример
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
Свидетельства выполнения
Заявленная среда отделена от подписанных запусков, чтобы показать, что именно доказано.
Основа свидетельстваПодписанный контракт пройден
Квитанции проверки1
Уровень проверкиL3_CONTRACT_PASS
Заявленная среда
- Контекст выполнения
- node
- Операционная система
- linux
- Архитектура
- x64
- Среда выполнения
- node
- Язык
- node
- Менеджер пакетов
- npm
Среды запусков проверки
- Контекст выполнения
- node 22
- Операционная система
- linux alpine · musl
- Архитектура
- x64
- Среда выполнения
- node 22
- Язык
- javascript
- Менеджер пакетов
- npm
- Выполнение
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-17
Кейс
- Цель
- Handle Express res.format content negotiation 406 error dispatch, canonicalized err.types, unconditional Vary header, and default fallback semantics HOW
- Пакеты
-
express 4.21.2
- Окружение
- node
- Создан
- 2026-08-17T06:38:16Z
Что обычно предполагают
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.
Автор образца записал здесь то, чего ожидал бы разработчик или модель. Контракт ниже — это то, что действительно выполнялось.
Контракт
- 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()
Файлы
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test/contract.mjs
Скачать артефакт с исходным кодом (tar.gz)
Исходный сидер
csx-seed
Квитанции проверки
- node 22 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-17 · ed25519:d91480838ac982c9