From 90071866076617de1693c0edd50e62b6aa7f763b Mon Sep 17 00:00:00 2001 From: saltyaom Date: Tue, 22 Oct 2024 01:32:38 +0700 Subject: [PATCH] :wrench: fix: handle .then --- src/handler.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/handler.ts b/src/handler.ts index 68eda150..fedb8d73 100644 --- a/src/handler.ts +++ b/src/handler.ts @@ -847,11 +847,11 @@ export const mapEarlyResponse = ( // @ts-expect-error if (typeof response?.then === 'function') // @ts-expect-error - return response.then((x) => mapResponse(x, set)) as any + return response.then((x) => mapEarlyResponse(x, set)) as any // @ts-expect-error if (typeof response?.toResponse === 'function') - return mapResponse((response as any).toResponse(), set) + return mapEarlyResponse((response as any).toResponse(), set) if ('charCodeAt' in (response as any)) { const code = (response as any).charCodeAt(0) @@ -987,11 +987,11 @@ export const mapEarlyResponse = ( // @ts-expect-error if (typeof response?.then === 'function') // @ts-expect-error - return response.then((x) => mapResponse(x, set)) as any + return response.then((x) => mapEarlyResponse(x, set)) as any // @ts-expect-error if (typeof response?.toResponse === 'function') - return mapResponse((response as any).toResponse(), set) + return mapEarlyResponse((response as any).toResponse(), set) if ('charCodeAt' in (response as any)) { const code = (response as any).charCodeAt(0) @@ -1128,7 +1128,7 @@ export const mapCompactResponse = ( // @ts-expect-error if (typeof response?.toResponse === 'function') - return mapResponse((response as any).toResponse(), set) + return mapCompactResponse((response as any).toResponse()) if ('charCodeAt' in (response as any)) { const code = (response as any).charCodeAt(0)