Summary
When a request explicitly excludes both text/html and text/markdown (e.g. Accept: application/json), the Nuxt adapter returns a 406 with no headers at all:
return new Response('Not Acceptable', { status: 406 });
No Vary: Accept, no Content-Type, no supported-types body.
Spec
content-negotiation.md section 4:
The 406 response:
- MUST set
Vary: Accept
- SHOULD include a body listing supported types
The missing Vary: Accept is a MUST violation (a shared cache can key the 406 incorrectly), and the missing Content-Type means the plain-text body can be mis-sniffed.
Where
Both the generated collection middleware and the runtime middleware:
packages/nuxt/src/module.ts (the getMiddlewareCode template, ~line 284)
packages/nuxt/src/runtime/server/endpoints/middleware.ts (~line 38)
Every other adapter already sets these headers on its 406 (e.g. packages/cloudflare/src/worker.ts).
Proposed fix
Return the 406 with Content-Type: text/plain; charset=utf-8, Vary: Accept, and a supported-types body, matching the other adapters. PR incoming.
Summary
When a request explicitly excludes both
text/htmlandtext/markdown(e.g.Accept: application/json), the Nuxt adapter returns a 406 with no headers at all:No
Vary: Accept, noContent-Type, no supported-types body.Spec
content-negotiation.md section 4:
The missing
Vary: Acceptis a MUST violation (a shared cache can key the 406 incorrectly), and the missingContent-Typemeans the plain-text body can be mis-sniffed.Where
Both the generated collection middleware and the runtime middleware:
packages/nuxt/src/module.ts(thegetMiddlewareCodetemplate, ~line 284)packages/nuxt/src/runtime/server/endpoints/middleware.ts(~line 38)Every other adapter already sets these headers on its 406 (e.g.
packages/cloudflare/src/worker.ts).Proposed fix
Return the 406 with
Content-Type: text/plain; charset=utf-8,Vary: Accept, and a supported-types body, matching the other adapters. PR incoming.