@aikidosec/firewall
Version:
Zen by Aikido is an embedded Application Firewall that autonomously protects Node.js apps against common and critical attacks, provides rate limiting, detects malicious traffic (including bots), and more.
17 lines (16 loc) • 649 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapRequestHandler = wrapRequestHandler;
const Context_1 = require("../../agent/Context");
const contextFromRequest_1 = require("./contextFromRequest");
function wrapRequestHandler(handler) {
// oxlint-disable-next-line require-await
return async (request, h) => {
const context = (0, contextFromRequest_1.contextFromRequest)(request);
return (0, Context_1.runWithContext)(context, () => {
return handler.apply(
// @ts-expect-error We don't now the type of this
this, [request, h]);
});
};
}