Return a 404 status code when a data route is .notFound (vercel/turbo#3545)

Returning a 404 status code is required for the client-side router to
redirect to the error page.
This commit is contained in:
Alex Kirszenberg 2023-01-31 17:43:01 +01:00 committed by GitHub
parent 7409489910
commit 779bb9e06a

View file

@ -206,7 +206,9 @@ export default function startHandler({
if (isDataReq) {
return {
type: "response",
statusCode,
// Returning a 404 status code is required for the client-side router
// to redirect to the error page.
statusCode: 404,
body: '{"notFound":true}',
headers: [["Content-Type", MIME_APPLICATION_JAVASCRIPT]],
};