Taxum / @taxum/core / middleware/limit / RequestBodyLimitLayer
Class: RequestBodyLimitLayer
Defined in: middleware/limit.ts:20
A middleware that intercepts requests with body lengths greater than the configured limit and converts them into 413 Payload Too Large
responses.
Example
ts
import { RequestBodyLimitLayer } from "@taxum/core/middleware/limit";
import { m, Router } from "@taxum/core/routing";
const router = new Router()
.route("/", m.get(() => "Hello World))
.middleware(new RequestBodyLimitLayer(1024 * 1024));
Implements
Constructors
Constructor
new RequestBodyLimitLayer(
limit
):RequestBodyLimitLayer
Defined in: middleware/limit.ts:28
Creates a new RequestBodyLimitLayer.
Parameters
limit
number
maximum size in bytes.
Returns
RequestBodyLimitLayer
Methods
layer()
layer(
inner
):HttpService
Defined in: middleware/limit.ts:32
Wrap the given service with the middleware, returning a new service that has been decorated with the middleware.