diff --git a/src/runtime/internal/renderer.ts b/src/runtime/internal/renderer.ts index 6c2e492b95..356eaffbe1 100644 --- a/src/runtime/internal/renderer.ts +++ b/src/runtime/internal/renderer.ts @@ -34,12 +34,14 @@ export function defineRenderHandler(render: RenderHandler) { ctx.response = await ctx.render(event); - const _currentStatus = getResponseStatus(event); - setResponseStatus(event, _currentStatus === 200 ? 500 : _currentStatus); - return send( - event, - "No response returned from render handler: " + event.path - ); + if (!ctx.response) { + const _currentStatus = getResponseStatus(event); + setResponseStatus(event, _currentStatus === 200 ? 500 : _currentStatus); + return send( + event, + "No response returned from render handler: " + event.path + ); + } } // Allow modifying response