Skip to content

Commit

Permalink
fix: fix promise handler and proxyOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
radyakaze committed Oct 7, 2024
1 parent d5e0e96 commit 9bedc91
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const proxyHandler = (config: ProxyParty) => {
const url = joinURL(config.target, path)

if (typeof config.handler === 'function') {
if (config.handler instanceof Promise) {
if (config.handler.constructor.name == 'AsyncFunction') {
await config.handler(event)
}
else {
Expand All @@ -30,7 +30,7 @@ const proxyHandler = (config: ProxyParty) => {
}

const options = typeof config.proxyOptions === 'function'
? config.proxyOptions instanceof Promise
? config.proxyOptions.constructor.name == 'AsyncFunction'
? await config.proxyOptions(event)
: config.proxyOptions(event)
: config.proxyOptions
Expand Down

0 comments on commit 9bedc91

Please sign in to comment.