Skip to content

Commit

Permalink
middleware rework
Browse files Browse the repository at this point in the history
  • Loading branch information
RWilcox-Reapit committed Feb 9, 2024
1 parent b0efda6 commit 1df9b64
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/constructs/edge-api/src/lambdas/origin-selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ export const handler = async (event: CloudFrontRequestEvent): Promise<CloudFront

for (const middleware of middlewares) {
try {
await eval(middleware)(req, mapping)
const fn = eval(middleware)
const res = await fn(req, mapping)
if (res) {
return res
}
} catch (e) {
console.error(e)
}
Expand Down

0 comments on commit 1df9b64

Please sign in to comment.