@@ -6,6 +6,7 @@ package fiber
6
6
7
7
import (
8
8
"bytes"
9
+ "errors"
9
10
"fmt"
10
11
"html"
11
12
"sort"
@@ -214,16 +215,14 @@ func (app *App) defaultRequestHandler(rctx *fasthttp.RequestCtx) {
214
215
// Acquire DefaultCtx from the pool
215
216
ctx , ok := app .AcquireCtx (rctx ).(* DefaultCtx )
216
217
if ! ok {
217
- // Should not happen, but just in case:
218
- panic ("defaultRequestHandler: failed to type-assert *DefaultCtx" )
218
+ panic (errors .New ("requestHandler: failed to type-assert to *DefaultCtx" ))
219
219
}
220
220
221
221
defer app .ReleaseCtx (ctx )
222
222
223
223
// Check if the HTTP method is valid
224
- // (e.g., methodInt returns -1 if it's not found in app.config.RequestMethods)
225
224
if ctx .methodINT == - 1 {
226
- _ = ctx .SendStatus (StatusNotImplemented )
225
+ _ = ctx .SendStatus (StatusNotImplemented ) //nolint:errcheck // Always return nil
227
226
return
228
227
}
229
228
@@ -237,24 +236,24 @@ func (app *App) defaultRequestHandler(rctx *fasthttp.RequestCtx) {
237
236
_ , err := app .next (ctx )
238
237
if err != nil {
239
238
if catch := ctx .App ().ErrorHandler (ctx , err ); catch != nil {
240
- _ = ctx .SendStatus (StatusInternalServerError )
239
+ _ = ctx .SendStatus (StatusInternalServerError ) //nolint:errcheck // Always return nil
241
240
}
241
+ // TODO: Do we need to return here?
242
242
}
243
243
}
244
244
245
245
func (app * App ) customRequestHandler (rctx * fasthttp.RequestCtx ) {
246
246
// Acquire CustomCtx from the pool
247
247
c , ok := app .AcquireCtx (rctx ).(CustomCtx )
248
248
if ! ok {
249
- // Should not happen, but just in case:
250
- panic ("customRequestHandler: failed to type-assert CustomCtx" )
249
+ panic (errors .New ("requestHandler: failed to type-assert to CustomCtx" ))
251
250
}
252
251
253
252
defer app .ReleaseCtx (c )
254
253
255
254
// Check if the HTTP method is valid
256
255
if app .methodInt (c .Method ()) == - 1 {
257
- _ = c .SendStatus (StatusNotImplemented )
256
+ _ = c .SendStatus (StatusNotImplemented ) //nolint:errcheck // Always return nil
258
257
return
259
258
}
260
259
@@ -268,8 +267,9 @@ func (app *App) customRequestHandler(rctx *fasthttp.RequestCtx) {
268
267
_ , err := app .nextCustom (c )
269
268
if err != nil {
270
269
if catch := c .App ().ErrorHandler (c , err ); catch != nil {
271
- _ = c .SendStatus (StatusInternalServerError )
270
+ _ = c .SendStatus (StatusInternalServerError ) //nolint:errcheck // Always return nil
272
271
}
272
+ // TODO: Do we need to return here?
273
273
}
274
274
}
275
275
0 commit comments