We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 71c4d00 commit faf4415Copy full SHA for faf4415
1 file changed
index.js
@@ -56,7 +56,8 @@ module.exports = function(options) {
56
let origin;
57
if (typeof options.origin === 'function') {
58
origin = options.origin(ctx);
59
- if (origin instanceof Promise) origin = await origin;
+ const isAsync = origin.constructor.name === "AsyncFunction";
60
+ if (origin instanceof Promise || isAsync) origin = await origin;
61
if (!origin) return await next();
62
} else {
63
origin = options.origin || requestOrigin;
0 commit comments