Skip to content

Releases: gofiber/fiber

v1.12.1

27 Jun 15:18
df36654
Compare
Choose a tag to compare

🔥 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 over 404 Not Found when the path exist on another HTTP method #492

🧹 Updates


🩹 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


v1.12.0

19 Jun 09:41
308ab66
Compare
Choose a tag to compare

🔥 New


🧹 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
})

🩹 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

08 Jun 10:39
164fbb3
Compare
Choose a tag to compare

v1.11.x contains the new ErrorHandler #423 and started to move some popular middleware to the fiber core, more will follow:

🔥 New

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 if c.Next() has no match #430
  • Partial wildcard support in Static, due to the Fasthttp update we had to adjust our PathRewrite 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 contain Cannot %method %path
  • Added io.Reader support in ctx.Send
  • Added io.Reader support in ctx.Write

🧬 External Middlewares


v1.10.5

03 Jun 15:29
6e9fae8
Compare
Choose a tag to compare

🩹 Fixes

  • Hot-fix for app.Static caused by Fasthttp v1.13.1

v1.10.0

27 May 21:06
edb1001
Compare
Choose a tag to compare

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 of App, 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 for 8 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!",
		})
	})
}

🔥 New


🩹 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 to Lax if not set
  • c.Append() does not append duplicates anymore on case-sensitive values
  • c.SendFile("./404.html") would overwrite previous status codes, this has been fix. #391
  • app.Test Would throw an EOF error if you do not provide a Content-Length header when passing a body io.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


🌱 Third Party Middlewares

v1.9.6

11 May 11:43
99f95b2
Compare
Choose a tag to compare

🚀 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

v1.9.3

28 Apr 20:00
0419d08
Compare
Choose a tag to compare

🚀 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

🧹 Updates

🧬 Middleware

🩹 Fixes

  • Some code blocks are re-used #310
  • Fiber's string conversion w/o allocation is now used in c.Range function #312
  • Typo's in ctx.go #294

v1.9.2

24 Apr 01:40
5410267
Compare
Choose a tag to compare

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

🧹 Updates

🧬 Middleware

🗑️ 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 use c.Get("Cookies")

🗑️ Removed

Dependency Graph v1.9.2

v1.9.1

20 Apr 14:35
be2f278
Compare
Choose a tag to compare

v1.9.0

13 Apr 13:26
776fb47
Compare
Choose a tag to compare