feat: add MaxBodySize configurable limit for BSON/Protobuf binders

This commit is contained in:
water 2026-07-29 11:24:54 +08:00
parent 49f4e069f2
commit 3f68b0b0b4

View File

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