Skip to content

Commit 9007186

Browse files
committed
🔧 fix: handle .then
1 parent 243f8b5 commit 9007186

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/handler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -847,11 +847,11 @@ export const mapEarlyResponse = (
847847
// @ts-expect-error
848848
if (typeof response?.then === 'function')
849849
// @ts-expect-error
850-
return response.then((x) => mapResponse(x, set)) as any
850+
return response.then((x) => mapEarlyResponse(x, set)) as any
851851

852852
// @ts-expect-error
853853
if (typeof response?.toResponse === 'function')
854-
return mapResponse((response as any).toResponse(), set)
854+
return mapEarlyResponse((response as any).toResponse(), set)
855855

856856
if ('charCodeAt' in (response as any)) {
857857
const code = (response as any).charCodeAt(0)
@@ -987,11 +987,11 @@ export const mapEarlyResponse = (
987987
// @ts-expect-error
988988
if (typeof response?.then === 'function')
989989
// @ts-expect-error
990-
return response.then((x) => mapResponse(x, set)) as any
990+
return response.then((x) => mapEarlyResponse(x, set)) as any
991991

992992
// @ts-expect-error
993993
if (typeof response?.toResponse === 'function')
994-
return mapResponse((response as any).toResponse(), set)
994+
return mapEarlyResponse((response as any).toResponse(), set)
995995

996996
if ('charCodeAt' in (response as any)) {
997997
const code = (response as any).charCodeAt(0)
@@ -1128,7 +1128,7 @@ export const mapCompactResponse = (
11281128

11291129
// @ts-expect-error
11301130
if (typeof response?.toResponse === 'function')
1131-
return mapResponse((response as any).toResponse(), set)
1131+
return mapCompactResponse((response as any).toResponse())
11321132

11331133
if ('charCodeAt' in (response as any)) {
11341134
const code = (response as any).charCodeAt(0)

0 commit comments

Comments
 (0)