We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Start
Server functions should able to return Raw Response objects.
https://github.com/nekochan0122/tanstack-start-return-response-object
const serverFn = createServerFn({ method: "POST" }).handler(async () => { return new Response(JSON.stringify({ hello: "world" }), { status: 200, headers: { "Content-Type": "application/json", "Set-Cookie": "test=test", }, }); });
{ hello: "world" }
test=test
No response
The text was updated successfully, but these errors were encountered:
a temporary solution:
async function handleResponse<ResponseBody = unknown>(response: Response): Promise<ResponseBody> { const event = getEvent() setHeaders(event, Object.fromEntries(response.headers)) switch (response.headers.get('Content-Type')) { case 'application/json': return response.json() as ResponseBody default: return response.body as ResponseBody } }
Sorry, something went wrong.
No branches or pull requests
Which project does this relate to?
Start
Describe the bug
Server functions should able to return Raw Response objects.
Your Example Website or App
https://github.com/nekochan0122/tanstack-start-return-response-object
Steps to Reproduce the Bug or Issue
Expected behavior
{ hello: "world" }
test=test
Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: