Skip to content

fix(nuxt): set Vary and Content-Type on the 406 response#81

Open
abhay-codes07 wants to merge 1 commit into
dodopayments:mainfrom
abhay-codes07:fix/nuxt-406-headers
Open

fix(nuxt): set Vary and Content-Type on the 406 response#81
abhay-codes07 wants to merge 1 commit into
dodopayments:mainfrom
abhay-codes07:fix/nuxt-406-headers

Conversation

@abhay-codes07

Copy link
Copy Markdown

Summary

The Nuxt adapter returned a bare Not Acceptable 406 with no headers, so it was missing the spec-required Vary: Accept (and had no Content-Type or supported-types body). This matches it to the other adapters.

Closes #80.

Changes

  • packages/nuxt/src/runtime/server/endpoints/middleware.ts and the getMiddlewareCode template in packages/nuxt/src/module.ts: the 406 now returns Content-Type: text/plain; charset=utf-8, Vary: Accept, and a body listing the supported types.
  • Extended the existing Nuxt 406 test to assert Vary contains Accept and the Content-Type is text/plain.

Type

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change
  • Spec change (requires bump in AEO_SPEC_VERSION)
  • Docs / examples / tooling only

Verification

  • bun run build passes
  • bun run test passes (nuxt: 49 tests)
  • bun run typecheck passes
  • If touching examples: ran dualmark verify (no examples touched)
  • If touching /spec/: ran sync-spec (no spec files touched)

Changeset

  • Added a changeset (patch for @dualmark/nuxt)

cc @thepushkaraj @aagarwal1012.

The Nuxt adapter returned a bare 'Not Acceptable' 406 with no headers.
Per content-negotiation.md section 4 a 406 MUST set Vary: Accept, and it
should carry a Content-Type and a supported-types body. Match the other
adapters (text/plain, Vary: Accept, supported-types body) in both the
generated collection middleware and the runtime middleware.
Copilot AI review requested due to automatic review settings July 1, 2026 02:46
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

@abhay-codes07 is attempting to deploy a commit to the Dodo Payments Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR brings the Nuxt adapter’s 406 (“Not Acceptable”) response into compliance with the content negotiation spec by ensuring it includes the required response headers and a supported-types body, matching the behavior of other adapters.

Changes:

  • Update Nuxt runtime middleware and the generated middleware template to return a typed text/plain 406 with Vary: Accept and a supported-types body.
  • Extend the Nuxt middleware test to assert Vary includes Accept and Content-Type is text/plain.
  • Add a changeset to release the fix as a patch for @dualmark/nuxt.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/nuxt/src/runtime/server/endpoints/middleware.ts Adds Vary: Accept, Content-Type: text/plain; charset=utf-8, and a supported-types body to the runtime 406 response.
packages/nuxt/src/module.ts Updates the getMiddlewareCode template so generated collection middleware returns the same spec-compliant 406 response.
packages/nuxt/test/middleware.test.ts Adds assertions verifying Vary and Content-Type are present on 406 responses.
.changeset/nuxt-406-headers.md Declares a patch release for @dualmark/nuxt and documents the spec-compliance fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

expect(res).toBeInstanceOf(Response);
expect(res.status).toBe(406);
// Spec section 4: a 406 MUST set Vary: Accept and should be typed text/plain.
expect((res.headers.get('vary') ?? '').toLowerCase()).toContain('accept');
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.

Nuxt 406 response is missing Vary: Accept and Content-Type (spec section 4)

2 participants