Releases: gofiber/fiber
v1.12.3
🔥 New
- middleware/filesystem middleware ( similair to embed )
- All internal middleware packages will have simplified initiation, see logger readme for examples
🧹 Updates
- Add youtube videos to media 86ed761
- Add JSON fields to all structs 34ac831
- Add juandiii/go-jwk-security to third-party middleware list
- Update dependencies (
valyala/tcplisten
&x/sys
) af474e2#diff-37aff102a57d3d7b797f152915a6dc16 - Add reuseport logic to Fiber core to support prefork on windows until we wait for the new Fasthttp release af474e2
🩹 Fixes
- Disable colors in startup message if not supported by terminal 1e1f6ea
- Default host addr to
127.0.0.1
if left empty 0daee4c - Fix logger mw default values #526
- Catch possible panic in timeout mw e702a86#diff-0f4bc2201cef6b0f8968ebddbe5d2eea
v1.12.2
🔥 New
🧹 Updates
- Improve router performance #518 #518 ❤️ @ReneWerner87
- Bump
gofiber/utils v0.0.9
- Add benchmark charts for internal middleware tests
🩹 Fixes
v1.12.1
🔥 New
- app.Settings.UnescapePath
Converts all encoded characters in the route back before setting the path for the context, so that the routing can also work with urlencoded special characters #506 - Router will return a
405 Method Not Allowed
over404 Not Found
when the path exist on another HTTP method #492
🧹 Updates
- app.Prefork is now supported on Windows #502
- app.Handler is now accessible #485 #504
- Update readme media section #511
- Update readme supporters section #508
- Update readme middleware section #507
- Update readme examples section #488
- Add SECURITY.md #484
- StartupMessage is colorized and contains more information
🩹 Fixes
- Remove panic on invalid method override #493
- Child procs will exit when killing the master process #501
- Timeout settings has been clarified #500 and middleware.Timeout has been added #489
- app.Routes() returns the correct path endpoints
- Fix typo in compress middleware #513
🧬 Internal Middleware
- middleware/timeout
Wrapper function which provides a handler with a timeout.
v1.12.0
🔥 New
- Abstract fiber.Router interface for
App
&Group
#476 - app.Settings.ReadBufferSize
Per-connection buffer size for requests' reading. This also limits the maximum header size. Increase this buffer if your clients send multi-KB RequestURIs and/or multi-KB headers (for example, BIG cookies). - app.Settings.WriteBufferSize
Per-connection buffer size for responses' writing. - app.Settings.Views
We added a new template interface namedViews
, click here to see an example.
The old Template interface is still backward compatible but it does not support the new features.
🧹 Updates
- The hyphen (
-
) and the dot (.
) are now interpreted literally in paths, they can be used along with route parameters for useful purposes. Thank you @ReneWerner87
// http://localhost:3000/plantae/prunus.persica
app.Get("/plantae/:genus.:species", func(c *fiber.Ctx) {
c.Params("genus") // prunus
c.Params("species") // persica
})
// http://localhost:3000/flights/LAX-SFO
app.Get("/flights/:from-:to", func(c *fiber.Ctx) {
c.Params("from") // LAX
c.Params("to") // SFO
})
- ctx.Render(tmpl string, values interface{}, layout ...string) error #441
Now supports an additionallayout string
argument. Special thanks to @bdtomlin - gofiber/template bumped to
v1.5.0
- Add SECURITY.md #484
- Remove unnecessary badges #483
🩹 Fixes
- Avoid panic in
c.Subdomains
#475 - Do not use normalized path #482
- Fix unnecessary pass throughs for groups #487
- Fix
flag.Parse()
compatibility #469
v1.11.0
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
v1.10.5
v1.10.0
Dear 🐻 Gophers,
Fiber v1.10.0
is finally released and it has some important changes we would like to share with you.
⚠️ Breaking Changes
- All routes will return the registered
Route
metadata instead ofApp
, chaining methods won't be possible anymore. - All template settings are replaced by the new
ctx.Settings.Templates
interface. See our updated template middleware for examples with support for8
template engines.
📚 Show syntax
type Engine struct {
templates *template.Template
}
func (e *Engine) Render(w io.Writer, name string, data interface{}) error {
return e.templates.ExecuteTemplate(w, name, data)
}
func main() {
app := fiber.New()
engine := &Engine{
// ./views/index.html
// <h1>{{.Title}}</h1>
templates: template.Must(template.ParseGlob("./views/*.html")),
}
app.Settings.Template = engine
app.Get("/hello", func(c *fiber.Ctx) {
c.Render("index", fiber.Map{
"Title": "Hello, World!",
})
})
}
ctx.Body(key ...string)
Accessing form data viaBody
is deprecated, please usectx.FormValue(key string)
instead.ctx.Cookies(key ...string)
To get the rawCookie
header, please usectx.Get("Cookies")
instead.
🔥 New
- Handler type has been added
- app.Add register handlers with a HTTP method input:
app.Add("GET", "/foo", handler)
. - app.Settings.Templates is the interface that wraps the Render function #331.
- app.Settings.DisableHeaderNormalizing Disable normalization:
conteNT-tYPE -> Content-Type
- ctx.Context() returns context.Context that carries a deadline, a cancellation signal, and other values across API boundaries. #383
🩹 Fixes
- Exact param keys in request paths are now matched as static paths #405
c.Params()
now accepting case sensitive values and keys #392- Cookies
SameSite
attribute defaults toLax
if not set c.Append()
does not append duplicates anymore on case-sensitive valuesc.SendFile("./404.html")
would overwrite previous status codes, this has been fix. #391app.Test
Would throw anEOF
error if you do not provide aContent-Length
header when passing a bodyio.Reader
with NewRequest. This is not necessary anymore, it will add the header for you if not provided.ctx.Protocol()
also checks the"X-Forwarded-Protocol"
,"X-Forwarded-Ssl"
and"X-Url-Scheme"
headers
🧹 Updates
- app.Use & app.Group now supports
/:params
&/:optionals?
inside the prefix path. - Fiber docs are now fully translated in Russian & Chinese
- Add new supporters to README's
- Update template examples in README's
- Add
./public
to Static examples in README's #411 - Add new media articles to README's Improve performance & web-based authentication
- With the help of @ReneWerner87 we produce zero garbage on matching and dispatching incoming requests. The only heap allocations that are made, is by building the key-value pairs for path parameters. If the requested route contains no parameters, not a single allocation is necessary.
🧬 Official Middlewares
- gofiber/utils
v0.0.3
- gofiber/logger
v0.1.1
- gofiber/session
v1.1.0
- gofiber/template
v1.3.0
- gofiber/websocket
v0.2.1
🌱 Third Party Middlewares
v1.9.6
🚀 Fiber v1.9.6
Special thanks to @renanbastos93 & @ReneWerner87 for optimizing the current router.
Help use translate our API documentation by clicking here
🔥 New
AcquireCtx
/ReleaseCtx
The Ctx pool is now accessible for third-party packages- Fiber docs merged Russian translations 84%
- Fiber docs merged Spanish translations 65%
- Fiber docs merged French translations 40%
- Fiber docs merged German translations 32%
- Fiber docs merged Portuguese translations 24%
🩹 Fixes
- Hotfix for interpolated params in nested routes #354
- Some
Ctx
methods didn't work correctly when called without an*App
pointer. ctx.Vary
sometimes added duplicates to the response header- Improved router by ditching regexp and increased performance by 817% without allocations.
// Tested with 350 github API routes
Benchmark_Router_OLD-4 614 2467460 ns/op 68902 B/op 600 allocs/op
Benchmark_Router_NEW-4 3429 302033 ns/op 0 B/op 0 allocs/op
🧹 Updates
- Add context benchmarks
- Remove some unnecessary functions from
utils
- Add router & param test cases
- Add new coffee supporters to readme
- Add third party middlewares to readme
- Add more comments to source code
- Cleanup some old helper functions
🧬 Middleware
- gofiber/adaptor
v0.0.1
Converter for net/http handlers to/from Fiber handlers - gofiber/session
v1.0.0
big improvements and support for storage providers - gofiber/logger
v0.0.6
supports${error}
param - gofiber/embed
v0.0.9
minor improvements and support for directory browsing
v1.9.3
🚀 Fiber v1.9.3
go get -u github.com/gofiber/fiber
Special thanks to @monzarrugh, @renanbastos93, @glaucia86, @bestgopher, @ofirrock, @jozsefsallai, @thomasvvugt, @elliotforbes, @Khaibin, @tianhongw, @arsmn, @da-z and everyone else who helped contribute to make this tag possible.
🔥 New
- API Documentation is translatable here https://crowdin.com/project/gofiber #309
c.Fresh()
Experimental, not bulletproof for production #317 #311- Full address will be printed on listening
:3000
=>0.0.0.0:3000
- New discord server https://gofiber.io/discord
- Added statuscodes
421
,103
#306 c.BodyParser()
allows duplicate query keys #316 #288- Hebrew translation README_he.md #303
- Settings.DisableStartupMessage
When set to true, it will not print out the fiber ASCII and `.. listening on ..`` message
- Settings.ETag
Enable or disable ETag header generation, since both weak and strong etags are generated using the same hashing method (CRC-32). Weak ETags are the default when enabled. - Fiber on youtube https://youtu.be/Iq2qT0fRhAA @elliotforbes
🧹 Updates
c.BodyParser()
will now ignore missing fields by default #308- Add new media links to README's
- Add
SaveFile
test #315 - Add
FormFile
test #315 - Update supporters in all README's
- Updated contributing.md #289
🧬 Middleware
- arsmn/fiber-swagger #276
- gofiber/embed
v0.0.8
- gofiber/logger
v0.0.4
🩹 Fixes
v1.9.2
Special thanks to József Sallai, Ray Mayemir, Encendre,Matthew Lee, Alireza Salary & Thomas van Vugt and everyone else who helped contribute to make this possible.
🔥 New
- New official website -> https://gofiber.io thanks for the landingpage @jozsefsallai
- README.md translated in Dutch @thomasvvugt
🧹 Updates
- API Docs moved to https://docs.gofiber.io
- Bumb fasthttp to
v1.12.0
🧬 Middleware
- https://github.com/gofiber/embed @arsmn
- https://github.com/gofiber/pprof gofiber/recipes#7
🗑️ Deprecated
- c.Body() is not used for form values anymore.
Use c.FormValue() to access any form value. - c.Cookies() must have a key.
If you want the raw cookie header please usec.Get("Cookies")
🗑️ Removed
- json-iterator dependency json-iterator/go#455
- travis.yml is replaced with github actions
Dependency Graph v1.9.2