Skip to content

Commit da640e8

Browse files
committed
feat: Deprecated ErrStatusRequestEntityTooLarge
1 parent f22ba67 commit da640e8

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

echo.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ var (
304304
ErrGone = NewHTTPError(http.StatusGone) // HTTP 410 Gone
305305
ErrLengthRequired = NewHTTPError(http.StatusLengthRequired) // HTTP 411 Length Required
306306
ErrPreconditionFailed = NewHTTPError(http.StatusPreconditionFailed) // HTTP 412 Precondition Failed
307-
ErrStatusRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge) // HTTP 413 Payload Too Large
307+
ErrStatusRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge) // Deprecated: Use ErrRequestEntityTooLarge instead
308+
ErrRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge) // HTTP 413 Payload Too Large
308309
ErrRequestURITooLong = NewHTTPError(http.StatusRequestURITooLong) // HTTP 414 URI Too Long
309310
ErrUnsupportedMediaType = NewHTTPError(http.StatusUnsupportedMediaType) // HTTP 415 Unsupported Media Type
310311
ErrRequestedRangeNotSatisfiable = NewHTTPError(http.StatusRequestedRangeNotSatisfiable) // HTTP 416 Range Not Satisfiable

middleware/body_limit.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func BodyLimitWithConfig(config BodyLimitConfig) echo.MiddlewareFunc {
7575

7676
// Based on content length
7777
if req.ContentLength > config.limit {
78-
return echo.ErrStatusRequestEntityTooLarge
78+
return echo.ErrRequestEntityTooLarge
7979
}
8080

8181
// Based on content read
@@ -93,7 +93,7 @@ func (r *limitedReader) Read(b []byte) (n int, err error) {
9393
n, err = r.reader.Read(b)
9494
r.read += int64(n)
9595
if r.read > r.limit {
96-
return n, echo.ErrStatusRequestEntityTooLarge
96+
return n, echo.ErrRequestEntityTooLarge
9797
}
9898
return
9999
}

middleware/body_limit_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func TestBodyLimitReader(t *testing.T) {
7171
context: e.NewContext(req, rec),
7272
}
7373

74-
// read all should return ErrStatusRequestEntityTooLarge
74+
// read all should return ErrRequestEntityTooLarge
7575
_, err := io.ReadAll(reader)
7676
he := err.(*echo.HTTPError)
7777
assert.Equal(t, http.StatusRequestEntityTooLarge, he.Code)

0 commit comments

Comments
 (0)