-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
Which project does this relate to?
Start
Describe the bug
When setting response headers using setResponseHeaders or response status using setResponseStatus in a global middleware server handler, the headers and status are not set.
setResponseHeader works as expected.
Your Example Website or App
https://github.com/nickprinsloo/tss-example
Steps to Reproduce the Bug or Issue
Given the following start.ts:
import { createMiddleware, createStart } from "@tanstack/react-start";
import { setResponseHeaders, setResponseStatus } from "@tanstack/react-start/server";
const requestMiddleware = createMiddleware().server(({ next }) => {
const headers = new Headers()
headers.set("X-Hello", "World")
headers.set("X-Foo", "Bar")
setResponseHeaders(headers)
setResponseStatus(404)
return next()
})
export const startInstance = createStart(() => {
return {
requestMiddleware: [requestMiddleware],
};
});
I'd expect the custom headers + status to be present on the response.
Expected behavior
As a user, I expect to see the headers and status of the response to be those set in the global middleware.
Screenshots or Videos
No response
Platform
- Start: ^1.132.48
- Node: v22.19.0
- macOS Tahoe
Additional context
No response
dvorakdominik and chrstntdd