v1.11.x
contains the new ErrorHandler #423 and started to move some popular middleware to the fiber core, more will follow:
- middleware.Recover()
- middleware.Compress()
- middleware.RequestID()
- middleware.Logger()
- middleware.Favicon()
🔥 New
- fiber.*Error
Custom Error struct that can be used as an error but contains an extraCode
int field - fiber.NewError(code int, message ...string)
Creates a new Error instance to be used with the error handler - predefined errors
var (
ErrContinue = NewError(StatusContinue) // RFC 7231, 6.2.1
ErrSwitchingProtocols = NewError(StatusSwitchingProtocols) // RFC 7231, 6.2.2
// etc...
- app.App()
App returns the *App reference to access Settings or ErrorHandler - app.Routes()
Routes returns all registered routes - app.Settings.ErrorHandler
Fiber supports centralized error handling by passing an error argument into the Next method which allows you to log errors to external services or send a customized HTTP response to the client. - ctx.SendStream
Sets response body stream and optional body size - app.Settings.CompressedFileSuffix
The suffix that is used when a compressed file under the new file name is made, defaults to.fiber.gz
.
🩹 Fixes
- Return
404
ifc.Next()
has no match #430 - Partial wildcard support in
Static
, due to the Fasthttp update we had to adjust ourPathRewrite
rewrite function. Thanks for the fix @ReneWerner87 utf-8
charset is now the default for content-type related ctx methods- Fix content-type issue with multiple
Static
routes #420
🧹 Updates
- ctx.Download() error
returns an error - ctx.SendFile() error
returns an error and add support for range requests by default - If a route does not match the request, the
404
response will containCannot %method %path
- Added
io.Reader
support in ctx.Send - Added
io.Reader
support in ctx.Write
🧬 External Middlewares
- gofiber/basicauth
v0.2.0
- gofiber/utils
v0.0.5