UNPKG

@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.

18 lines (17 loc) 1.08 kB
import { RequestContextStorage } from "./RequestContextStorage"; import type { Dispatcher } from "undici-v6"; import type { Dispatcher as DispatcherV8 } from "undici-v8"; import { Context } from "../../agent/Context"; type OnHeaders = Dispatcher.DispatchHandlers["onHeaders"]; type OnResponseStart = DispatcherV8.DispatchHandler["onResponseStart"]; /** * Wrap the onHeaders function and check if the response is a redirect. If yes, determine the destination URL and call onRedirect. * This is the undici v6 / legacy handler API */ export declare function wrapOnHeaders(orig: OnHeaders, requestContext: ReturnType<typeof RequestContextStorage.getStore>, context: Context): OnHeaders; /** * Wrap the onResponseStart function (undici v7 / Node.js v26+ handler API) and check if the response is a redirect. * Headers are passed as a plain object with lowercase keys instead of a Buffer array. */ export declare function wrapOnResponseStart(orig: OnResponseStart, requestContext: ReturnType<typeof RequestContextStorage.getStore>, context: Context): OnResponseStart; export {};