Fiber Versions Save

โšก๏ธ Express inspired web framework written in Go

v2.49.0

8 months ago

โ— Breaking Changes

EnableSplittingOnParsers splits the query/body/header parameters by comma when it's true (default: false).

For example, you can use it to parse multiple values from a query parameter like this: /api?foo=bar,baz == foo[]=bar&foo[]=baz

๐Ÿš€ New

This allows the user to use //go:embed flags to load favicon data during build-time, and supply it to the middleware instead of reading the file every time the application starts.

๐Ÿงน Updates

  • Middleware/logger: Latency match gin-gonic/gin formatter (#2569)
  • Middleware/filesystem: Refactor: use errors.Is instead of os.IsNotExist (#2558)
  • Use Global vars instead of local vars for isLocalHost (#2595)
  • Remove redundant nil check (#2584)
  • Bump github.com/mattn/go-runewidth from 0.0.14 to 0.0.15 (#2551)
  • Bump github.com/google/uuid from 1.3.0 to 1.3.1 (#2592)
  • Bump golang.org/x/sys from 0.10.0 to 0.11.0 (#2563)
  • Add go 1.21 to ci and readmes (#2588)

๐Ÿ› Fixes

  • Middleware/logger: Default latency output format (#2580)
  • Decompress request body when multi Content-Encoding sent on request headers (#2555)

๐Ÿ“š Documentation

  • Fix wrong JSON docs (#2554)
  • Update io/ioutil package to io package (#2589)
  • Replace EG flag with the proper and smaller SVG (#2585)
  • Added Egyptian Arabic readme file (#2565)
  • Translate README to Portuguese (#2567)
  • Improve *fiber.Client section (#2553)
  • Improved the config section of the middleware readmeยดs (#2552)
  • Added documentation about ctx Fresh (#2549)
  • Update intro.md (#2550)
  • Fixed link to slim template engine (#2547)

Full Changelog: https://github.com/gofiber/fiber/compare/v2.48.0...v2.49.0

Thank you @Jictyvoo, @Juneezee, @Kirari04, @LimJiAn, @PassTheMayo, @andersonmiranda-com, @bigpreshy, @efectn, @renanbastos93, @scandar, @sixcolors and @stefanb for making this update possible.

v2.48.0

9 months ago

๐Ÿš€ New

app := fiber.New(fiber.Config{
  DisableStartupMessage: true,
})

app.Hooks().OnListen(func(listenData fiber.ListenData) error {
  if fiber.IsChild() {
      return nil
  }
  scheme := "http"
  if data.TLS {
    scheme = "https"
  }
  log.Println(scheme + "://" + listenData.Host + ":" + listenData.Port)
  return nil
})

app.Listen(":5000")

๐Ÿงน Updates

  • Dictpool is not completely gone (#2540)
  • Bump golang.org/x/sys from 0.9.0 to 0.10.0 (#2530)
  • Bump github.com/valyala/fasthttp from 1.47.0 to 1.48.0 (#2511)

๐Ÿ› Fixes

  • Middleware/logger: Default logger color behaviour (#2513)

๐Ÿ“š Documentation

  • Fix link (#2542)
  • Fix bad documentation on queries function (#2522)
  • Fix validation-guide (#2517)
  • Fix bad documentation on queries function (#2522)
  • Add a warning on security implications when using X-Forwarded-For improperly (#2520)
  • Fix typo (#2518)
  • Typo in ctx.md (#2516)
  • Fix comment in client.go (#2514)
  • Fix docs api fiber custom config (#2510)

Full Changelog: https://github.com/gofiber/fiber/compare/v2.47.0...v2.48.0

Thank you @ForAeons, @RHeynsZa, @Saman-Safaei, @Skyenought, @Z3NTL3, @andre-dasilva, @cmd777, @dozheiny, @efectn, @f1rstmehul, @gaby, @itcuihao and @mo1ein for making this update possible.

v2.47.0

10 months ago

๐Ÿš€ New

// GET /api/posts?filters.author.name=John&filters.category.name=Technology

app.Get("/", func(c *fiber.Ctx) error {
    m := c.Queries()
    m["filters.author.name"] // John
    m["filters.category.name"] // Technology
})
// Disable colors when outputting to default format
app.Use(logger.New(logger.Config{
    DisableColors: true,
}))

๐Ÿงน Updates

  • Update getOffer to consider quality and specificity (#2486)
  • Use c.app.getString instead of string(...) (#2489)
  • Bump github.com/mattn/go-isatty from 0.0.18 to 0.0.19 (#2474)
  • Bump golang.org/x/sys from 0.8.0 to 0.9.0 (#2508)

๐Ÿ› Fixes

  • Middleware/limiter: Fix Sliding Window limiter when SkipSuccessfulRequests/SkipFailedRequests is used. (#2484)
  • Fix onListen hooks when they are used with prefork mode (#2504)
  • Fix middleware naming and returned values of group methods (#2477)
  • Treat case for possible timer memory leak (#2488)
  • Reset terminal colors after print routes (#2481)

๐Ÿ“š Documentation

  • Update version of html template (#2505)
  • Translate README_fa.md (#2496)
  • Correcting a syntax error in the README (#2473)

Full Changelog: https://github.com/gofiber/fiber/compare/v2.46.0...v2.47.0

Thank you @Kamandlou, @Satont, @Skyenought, @cmd777, @dozheiny, @efectn, @gaby, @kaazedev, @luk3skyw4lker, @obakumen, @sixcolors and @ytsruh for making this update possible.

v2.46.0

11 months ago

๐Ÿš€ New

  • Utils: add Go 1.20+ way of converting byte slice to string (#2468)
  • Middleware/adaptor: allow to convert fiber.Ctx to (net/http).Request (#2461)

๐Ÿงน Updates

  • Speedup and cleanup "path" testcases and benchmarks (#2465)
  • Middleware/adaptor: allow to convert fiber.Ctx to (net/http).Request (#2461)
  • Utils: add Go 1.20+ way of converting string to byte slice (#2462)
  • Merge some external middlewares to core (#2453) https://docs.gofiber.io/category/-middleware

๐Ÿ› Fixes

  • Fix mount route positioning (#2463)

๐Ÿ“š Documentation

  • Update README_ru.md (#2456)

Full Changelog: https://github.com/gofiber/fiber/compare/v2.45.0...v2.46.0

Thank you @alekseikovrigin, @efectn and @leonklingele for making this update possible.

v2.45.0

1 year ago

๐Ÿš€ New

๐Ÿงน Updates

  • Consistent way of logging and fix middleware log format (#2432, #2444)
  • Improve error handling for net error(s) (#2421)
  • Bump golang.org/x/sys from 0.7.0 to 0.8.0 (#2449)
  • Bump github.com/valyala/fasthttp from 1.45.0 to 1.47.0 (#2426, #2445)

๐Ÿ› Fixes

  • Middleware/cors: Changed condition for 'AllowOriginsFunc' (#2423)

๐Ÿ“š Documentation

  • Correct errors in Italian translation (#2417)
  • Correct grammar errors in Azerbaijani translation. (#2413)

Full Changelog: https://github.com/gofiber/fiber/compare/v2.44.0...v2.45.0

Thank you @Jamess-Lucass, @baichangda, @carmeloriolo, @kanansnote and @kousikmitra for making this update possible.

v2.44.0

1 year ago

๐Ÿš€ New

๐Ÿ‘ฎ Security hint

Note: Using this feature is discouraged in production and it's best practice to explicitly set CORS origins via AllowOrigins.

In this example any origin will be allowed via CORS. For example, if a browser running on http://localhost:3000 sends a request, this will be accepted and the access-control-allow-origin response header will be set to http://localhost:3000.

app.Use(cors.New(cors.Config{
    AllowOriginsFunc: func(origin string) bool {
        return os.Getenv("ENVIRONMENT") == "development"
    },
}))

๐Ÿงน Updates

  • Bump golang.org/x/sys from 0.6.0 to 0.7.0 (#2405)
  • github/workflows: also run tests with Go 1.19.x (#2384)
  • Bump github.com/mattn/go-isatty from 0.0.17 to 0.0.18 (#2381)

๐Ÿ› Fixes

  • Middleware/logger: Fix #2396, data race logger middleware (#2397)
  • Middleware/timeout: Add original timeout middleware (#2367) https://docs.gofiber.io/next/api/middleware/timeout โ—With version v2.38.1 we changed the behavior of the timeout function, this has now been undone and a function for use with context has been provided
  • Mounted subapps don't work correctly if parent app attached (#2331)
  • Change default value of Querybool from true to false. (#2391) โ—The fallback value for not found or not boolean values was adjusted to the golang standard
  • Fix #2383, accepts mimeType (#2386)

๐Ÿ“š Documentation

  • Added Azerbaijani README translation (#2411)
  • Fix import and comma issues (#2410)
  • Fix typos, and make middleware documentation more consistent (#2408)
  • Added code link to fiber config fields (#2385)
  • Adding to fac sub domain routing (#2393)

Full Changelog: https://github.com/gofiber/fiber/compare/v2.43.0...v2.44.0

Thank you @Jamess-Lucass, @ancogamer, @cmd777, @dozheiny, @eld4niz, @hakankutluay, @jcyamacho, @leonklingele and @shahriarsohan for making this update possible.

v2.43.0

1 year ago

โ— BreakingChange

  • Drop go 1.16 support & update to fasthttp 1.45.0 (#2374)

Due to the fact that fasthttp, which fiber is based on in release 1.45.0, does not support go version 1.16 anymore, we had to remove it from our package as well.

๐Ÿš€ New

app.ListenTLSWithCertificate(":443", cert); 
app.ListenMutualTLSWithCertificate(":443", cert, clientCertPool);
// GET http://example.com/?name=alex&want_pizza=false&id=

app.Get("/", func(c *fiber.Ctx) error {
    c.QueryBool("want_pizza")       // false
    c.QueryBool("want_pizza", true) // false
    c.QueryBool("alex")             // true
    c.QueryBool("alex", false)      // false
    c.QueryBool("id")               // true
    c.QueryBool("id", false)        // false

  // ...
})
// GET http://example.com/?name=alex&amount=32.23&id=

app.Get("/", func(c *fiber.Ctx) error {
    c.QueryFloat("amount")      // 32.23
    c.QueryFloat("amount", 3)   // 32.23
    c.QueryFloat("name", 1)     // 1
    c.QueryFloat("name")        // 0
    c.QueryFloat("id", 3)       // 3

  // ...
})
  session.New(session.Config{
    // Decides whether cookie should last for only the browser sesison.
    CookieSessionOnly: true,
  })
// DoRedirects performs the given http request and fills the given http response while following up to maxRedirectsCount redirects.
func DoRedirects(c *fiber.Ctx, addr string, maxRedirectsCount int, clients ...*fasthttp.Client) error
// DoDeadline performs the given request and waits for response until the given deadline.
func DoDeadline(c *fiber.Ctx, addr string, deadline time.Time, clients ...*fasthttp.Client) error
// DoTimeout performs the given request and waits for response during the given timeout duration.
func DoTimeout(c *fiber.Ctx, addr string, timeout time.Duration, clients ...*fasthttp.Client) error

๐Ÿงน Updates

  • Get mime fallback (#2340)
  • Middleware/requestid: don't call "Generator" func on existing request ID header (#2371)
  • Middleware/basicauth: Optimize Basic auth alloc (#2333)

๐Ÿ› Fixes

  • Middleware/requestid: Config.ContextKey is interface{} (#2369)
  • Middleware/cors: Fix cors * behavior #2338 (#2339)

๐Ÿ“š Documentation

  • Use proper discord invitation link (#2382)
  • Corrected coding typos in MountPath docs section (#2379)
  • Fix typo in docs (#2357)
  • Fix(docs): add missing comma (#2353)
  • Fix all inaccessible links in docs (#2349)
  • Automated synchronization with gofiber/docs (#2344)

Full Changelog: https://github.com/gofiber/fiber/compare/v2.42.0...v2.43.0

Thank you @CaioAugustoo, @HHongSeungWoo, @IwateKyle, @Rorke76753, @Skyenought, @UtopiaGitHub, @benjajaja, @derkan, @dozheiny, @efectn, @gaby, @leonklingele, @lublak, @msaf1980, @ryand67 and @yvestumushimire for making this update possible.

v2.42.0

1 year ago

๐Ÿš€ New

// GET http://example.com/?id=5555
app.Get("/", func(c *fiber.Ctx) error {
    c.QueryInt("id", 1)         // 5555
    // ...
})

adds support for TLS 1.3's early data ("0-RTT") feature

app.Use(earlydata.New())

allows for fault-tolerant APIs where duplicate requests โ€” for example due to networking issues on the client-side โ€” do not erroneously cause the same action performed multiple times on the server-side.

app.Use(idempotency.New(idempotency.Config{
    Lifetime: 42 * time.Minute,
    // ...
}))
// If you want to forward with a specific domain. You have to use proxy.DomainForward.
app.Get("/payments", proxy.DomainForward("docs.gofiber.io", "http://localhost:8000"))

// Or this way if the balancer is using https and the destination server is only using http.
app.Use(proxy.BalancerForward([]string{
    "http://localhost:3001",
    "http://localhost:3002",
    "http://localhost:3003",
}))

๐Ÿงน Updates/CI

  • Middleware/favicon: Add url for favicon middleware, for correct handling different ofโ€ฆ (#2231) https://docs.gofiber.io/api/middleware/favicon
  • CI: Add go 1.20 to ci and readmes (#2322)
  • CI: Add and apply more stricter golangci-lint linting rules (#2286)
  • CI: Added testcases and minor algorithm improvment (#2308)
  • CI: Make most tests parallel (#2299)
  • CI: Bump github.com/valyala/fasthttp from 1.43.0 to 1.44.0 (#2292)

๐Ÿ› Fixes

  • CI: Fix issues introduced in linting PR (#2319)
  • Use app.getString, app.GetBytes instead of utils.UnsafeString, utils.UnsafeBytes in ctx.go (#2297)
  • Os: Fix gopsutil compilation (#2298)
  • Middleware/logger: logger color output (#2296)

๐Ÿ“š Documentation

  • Rework Chinese (Taiwan) translation of documentation (#2310)
  • Correct the figure link in READMEs (#2312)
  • Remove the redundant space beside a comma (#2309)
  • Add discord channel link (ID) (#2303)
  • Middleware/filesystem: fix statik filesystem middleware example typo (#2302)
  • Middleware/filesystem: clean duplicated namespace for example (#2313)
  • Middleware/limiter: fix alignment in limiter example (#2283)
  • Middleware/encryptcookie: Openssl rand -base64 32 hints (#2316)

Full Changelog: https://github.com/gofiber/fiber/compare/v2.41.0...v2.42.0

Thank you @0xdeface, @100gle, @TwiN, @cloudwindy, @dozheiny, @efectn, @leonklingele, @meehow, @pan93412, @rendiputra and @rhabichl for making this update possible.

v2.41.0

1 year ago

๐Ÿš€ New

๐Ÿงน Updates

  • Latency use lowest time unit in logger middleware (#2261)
  • Add more detail error message in serverErrorHandler (#2267)
  • Use fasthttp.AddMissingPort (#2268)
  • Set byteSent log to 0 when use SetBodyStreamWriter (#2239)
  • Unintended overwritten bind variables (#2240)
  • Bump github.com/valyala/fasthttp from 1.41.0 to 1.43.0 (#2237, #2245)
  • Bump github.com/mattn/go-isatty from 0.0.16 to 0.0.17 (#2279)

๐Ÿ› Fixes

  • Fix some warnings, go-ole on mac os (#2280)
  • Properly handle error of "net.ParseCIDR" in "(*App).handleTrustedProxy" (#2243)
  • Fix regex constraints that contain comma (#2256)
  • Unintended overwritten bind variables (#2240)

๐Ÿ“š Documentation

  • Fix ci badge errors (#2282)
  • Replace 1.14 with 1.16 in READMEs (#2265)
  • Update docstring for FormValue() (#2262)
  • Added Ukrainian README translation (#2249)
  • middleware/requestid: mention that the default UUID generator exposes the number of requests made to the server (#2241)
  • middleware/filesystem does not handle url encoded values on it's own (#2247)

Full Changelog: https://github.com/gofiber/fiber/compare/v2.40.1...v2.41.0

Thank you @AngelVI13, @Simerax, @cwinters8, @efectn, @jfcg, @leonklingele, @li-jin-gou, @pjebs, @shuuji3 and @v1def for making this update possible.

v2.40.1

1 year ago

๐Ÿ› Fixes

  • Fix mounting when mount prefix is / (#2227)

Full Changelog: https://github.com/gofiber/fiber/compare/v2.40.0...v2.40.1