Documentation
¶
Overview ¶
Package bodylimit 限制请求体大小,防止恶意大 Body 导致 OOM。
使用方式:
app.Use(bodylimit.New(bodylimit.Config{MaxBytes: 10 << 20})) // 10MB
超过限制时返回 HTTP 413 Request Entity Too Large。 该中间件零开销 — 仅在超过 MaxBytes 时才触发错误响应。
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{
MaxBytes: 10 << 20,
}
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.