HttpProtect.textMiddleware() method
A middleware that rejects with text/plain.
Signature:
textMiddleware(): (req: Request, res: Response, next: NextFunction) => Promise<void>;
Returns:
(req: Request, res: Response, next: NextFunction) => Promise<void>
An async middleware to hand to app.use().
Remarks
Sends the code and its reason phrase — 429 Too Many Requests, or 418 I'm a teapot for a ban. Sets Content-Type through Response.header() if the framework has it, Response.setHeader() otherwise, and omits it if neither exists.
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.