Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated ErrStatusRequestEntityTooLarge #2426

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion echo.go
Expand Up @@ -304,7 +304,8 @@ var (
ErrGone = NewHTTPError(http.StatusGone) // HTTP 410 Gone
ErrLengthRequired = NewHTTPError(http.StatusLengthRequired) // HTTP 411 Length Required
ErrPreconditionFailed = NewHTTPError(http.StatusPreconditionFailed) // HTTP 412 Precondition Failed
ErrStatusRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge) // HTTP 413 Payload Too Large
ErrStatusRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge) // Deprecated: Use ErrRequestEntityTooLarge instead
ErrRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge) // HTTP 413 Payload Too Large
ErrRequestURITooLong = NewHTTPError(http.StatusRequestURITooLong) // HTTP 414 URI Too Long
ErrUnsupportedMediaType = NewHTTPError(http.StatusUnsupportedMediaType) // HTTP 415 Unsupported Media Type
ErrRequestedRangeNotSatisfiable = NewHTTPError(http.StatusRequestedRangeNotSatisfiable) // HTTP 416 Range Not Satisfiable
Expand Down
4 changes: 2 additions & 2 deletions middleware/body_limit.go
Expand Up @@ -75,7 +75,7 @@ func BodyLimitWithConfig(config BodyLimitConfig) echo.MiddlewareFunc {

// Based on content length
if req.ContentLength > config.limit {
return echo.ErrStatusRequestEntityTooLarge
return echo.ErrRequestEntityTooLarge
}

// Based on content read
Expand All @@ -93,7 +93,7 @@ func (r *limitedReader) Read(b []byte) (n int, err error) {
n, err = r.reader.Read(b)
r.read += int64(n)
if r.read > r.limit {
return n, echo.ErrStatusRequestEntityTooLarge
return n, echo.ErrRequestEntityTooLarge
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion middleware/body_limit_test.go
Expand Up @@ -71,7 +71,7 @@ func TestBodyLimitReader(t *testing.T) {
context: e.NewContext(req, rec),
}

// read all should return ErrStatusRequestEntityTooLarge
// read all should return ErrRequestEntityTooLarge
_, err := io.ReadAll(reader)
he := err.(*echo.HTTPError)
assert.Equal(t, http.StatusRequestEntityTooLarge, he.Code)
Expand Down