Skip to content

fix(dev-server): accept compatible Response implementations - #370

Open
lurgi wants to merge 2 commits into
honojs:mainfrom
lurgi:fix/compatible-response
Open

lurgi wants to merge 2 commits into
honojs:mainfrom
lurgi:fix/compatible-response

Conversation

@lurgi

@lurgi lurgi commented Sep 29, 2026 •

Copy link
Copy Markdown

Closes #369.

Summary

  • replace the native Response constructor identity check with an explicit interface check and normalize compatible responses before passing them to the Node.js adapter
  • keep forwarding invalid application return values to Vite's error handler
  • add an end-to-end regression test using PonyfillResponse from @whatwg-node/node-fetch
  • add a patch changeset

This allows Fetch API-compatible implementations such as the response returned by GraphQL Yoga to work without requiring applications to recreate them with Node.js's global Response constructor. Compatible non-native responses are normalized at the adapter boundary so the downstream Node.js response writer receives the body shape it expects.

The existing check was introduced in #45 to reject invalid return values such as strings, and #63 later routed those values through Vite's error handler. This change preserves that behavior while validating the runtime interface without a type assertion, so compatible Response implementations are not treated as application errors.

Tests

  • yarn workspace @hono/vite-dev-server test:unit
  • yarn workspace @hono/vite-dev-server build
  • yarn workspace @hono/vite-dev-server exec playwright test e2e/basic/basic.test.ts --grep "another Fetch API implementation"
  • yarn format
  • yarn lint

@changeset-bot

changeset-bot Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 64ab4ea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hono/vite-dev-server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

[@hono/vite-dev-server] Accept standards-compatible Response implementations

1 participant