Skip to content

Commit

Permalink
🔧 fix: handle .then
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyAom committed Oct 21, 2024
1 parent 243f8b5 commit 9007186
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9007186

Please # to comment.