From 3f68b0b0b42901e2d897ad5b7d26c6952d6e8ccb Mon Sep 17 00:00:00 2001 From: water <672684719@qq.com> Date: Wed, 29 Jul 2026 11:24:54 +0800 Subject: [PATCH] feat: add MaxBodySize configurable limit for BSON/Protobuf binders --- binding/binding.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/binding/binding.go b/binding/binding.go index eced0ae2..c6142d5c 100644 --- a/binding/binding.go +++ b/binding/binding.go @@ -125,3 +125,9 @@ func validate(obj any) error { } return Validator.ValidateStruct(obj) } + +// MaxBodySize is the maximum request body size in bytes that BSON and +// Protobuf binders will read. If the request body exceeds this limit, +// the binding returns an error. Defaults to 32 MB. +var MaxBodySize int64 = 32 << 20 +