Skip to content

Commit faf4415

Browse files
committed
Include async functions in origins promise detection
1 parent 71c4d00 commit faf4415

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ module.exports = function(options) {
5656
let origin;
5757
if (typeof options.origin === 'function') {
5858
origin = options.origin(ctx);
59-
if (origin instanceof Promise) origin = await origin;
59+
const isAsync = origin.constructor.name === "AsyncFunction";
60+
if (origin instanceof Promise || isAsync) origin = await origin;
6061
if (!origin) return await next();
6162
} else {
6263
origin = options.origin || requestOrigin;

0 commit comments

Comments
 (0)