Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/hono/middleware/body-limit/index.ts>bodyLimit

Web Framework built on Web Standards
Very Popular
Go to Latest
variable bodyLimit
import { bodyLimit } from "https://deno.land/x/hono@v4.3.6/middleware/body-limit/index.ts";

Body Limit Middleware

Examples

Example 1

app.post(
 '/hello',
 bodyLimit({
   maxSize: 100 * 1024, // 100kb
   onError: (c) => {
     return c.text('overflow :(', 413)
   }
 }),
 (c) => {
   return c.text('pass :)')
 }
)

type

(options: BodyLimitOptions) => MiddlewareHandler