Skip to content

Commit 1d9a9f0

Browse files
committed
fix: return JSON response for not-found responses
1 parent 52cff05 commit 1d9a9f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/runtime/server/cache.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,10 @@ export default defineNitroPlugin(nitroApp => {
866866
headers: { 'content-type': 'application/json' },
867867
})
868868
}
869-
return new Response('Not Found', { status: 404 })
869+
return new Response(JSON.stringify({ error: 'Not Found' }), {
870+
status: 404,
871+
headers: { 'content-type': 'application/json' },
872+
})
870873
} catch (err: any) {
871874
// Convert createError exceptions to proper HTTP responses
872875
const statusCode = err?.statusCode || err?.status || 404

0 commit comments

Comments
 (0)