From b53170ace1a7eea1b5dc4ab017ec853369ce6eb4 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Sat, 30 Apr 2016 22:29:07 -0700 Subject: [PATCH] Updated readme Signed-off-by: Vishal Rana --- README.md | 1 + middleware/body_limit.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3299fa29..1612fba5 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,7 @@ e.GET("/users", func(c echo.Context) error { Middleware | Description :--- | :--- +[BodyLimit](https://labstack.com/echo/guide/middleware#bodylimit-middleware:37ab2f15ff048f67959bcac0a6032f32) | Limit request body [Logger](https://labstack.com/echo/guide/middleware#logger-middleware:37ab2f15ff048f67959bcac0a6032f32) | Log HTTP requests [Recover](https://labstack.com/echo/guide/middleware#recover-middleware:37ab2f15ff048f67959bcac0a6032f32) | Recover from panics [Gzip](https://labstack.com/echo/guide/middleware#gzip-middleware:37ab2f15ff048f67959bcac0a6032f32) | Send gzip HTTP response diff --git a/middleware/body_limit.go b/middleware/body_limit.go index 8e517b47..79a7fc31 100644 --- a/middleware/body_limit.go +++ b/middleware/body_limit.go @@ -13,6 +13,8 @@ import ( type ( // BodyLimitConfig defines the config for body limit middleware. BodyLimitConfig struct { + // Limit is the maximum allowed size for a request body, it can be specified + // as `4x` or `4xB`, where x is one of the multiple from K, M, G, T or P. Limit string `json:"limit"` limit int } @@ -31,7 +33,7 @@ type ( // size exceeds the configured limit, it sends "413 - Request Entity Too Large" // response. The body limit is determined based on the actually read and not `Content-Length` // request header, which makes it super secure. -// Limit can be specifed as `4x` or `4xB`, where x is one of the multple from K, M, +// Limit can be specified as `4x` or `4xB`, where x is one of the multiple from K, M, // G, T or P. func BodyLimit(limit string) echo.MiddlewareFunc { return BodyLimitWithConfig(BodyLimitConfig{Limit: limit})