Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]: nitro (production only) sends Response.json as html #1805

Open
2 tasks done
huseeiin opened this issue Feb 13, 2025 · 2 comments
Open
2 tasks done

[Bug?]: nitro (production only) sends Response.json as html #1805

huseeiin opened this issue Feb 13, 2025 · 2 comments
Labels
bug Something isn't working needs triage

Comments

@huseeiin
Copy link
Contributor

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

in dev, it sends the response with application/json which is expected

Expected behavior 🤔

in prod it sends text/html which is unexpected

Steps to reproduce 🕹

// create an api endpoint routes/test.ts:

import { APIEvent } from "@solidjs/start/server";

export function GET(event: APIEvent) {
  event.nativeEvent.respondWith(Response.json({ hello: "world" }));
}

Context 🔦

No response

Your environment 🌎

@huseeiin huseeiin added bug Something isn't working needs triage labels Feb 13, 2025
@huseeiin
Copy link
Contributor Author

after checking again, it includes both content-types (in both dev and prod):

Image

@huseeiin
Copy link
Contributor Author

this bug doesn't happen if you return a Response:

import { APIEvent } from "@solidjs/start/server";

export function GET(event: APIEvent) {
  return Response.json({ hello: "world" });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant