Skip to content

Releases: gofiber/fiber

v2.40.0

18 Nov 16:21
c8baa61
Compare
Choose a tag to compare

❗ BreakingChange

  • Bump github.com/valyala/fasthttp from 1.40.0 to 1.41.0 (#2171)
  • Deprecate: go 1.14 & go 1.15 support deprecation (#2172)

Due to the fact that fasthttp, which fiber is based on in release 1.41.0, does not support go versions 1.14 & 1.15 anymore, we had to remove them from our package as well.

🚀 New

// now you can add your own custom methods
app := fiber.New(fiber.Config{
    RequestMethods: append(fiber.DefaultMethods, "LOAD", "TEST"),
})

app.Add("LOAD", "/hello", func(c *fiber.Ctx) error {
    return c.SendString("Hello, World 👋!")
})
// declaration of multiple paths for the ".Use" method as in express is now possible
app.Use([]string{"/john", "/doe"}, func(c *Ctx) error {
    return c.SendString(c.Path())
})
app.Get("/:userId<int>?", func(c *fiber.Ctx) error {
    return c.SendString(c.Params("userId"))
})
// curl -X GET http://localhost:3000/42
// 42

// curl -X GET http://localhost:3000/
//
app := fiber.New()
micro := fiber.New()
// order when registering the mounted apps no longer plays a role
app.Mount("/john", micro)
// before there was problem when after mounting routes were registered
micro.Get("/doe", func(c *fiber.Ctx) error {
    return c.SendStatus(fiber.StatusOK)
})
// output of the mount path possible
micro.MountPath()   // "/john"
// In systems where you have multiple ingress endpoints, it is common to add a URL prefix, like so:
app.Use(pprof.New(pprof.Config{Prefix: "/endpoint-prefix"}))
app.Use(logger.New(logger.Config{
    Format: "[${time}] ${status} - ${latency} ${method} ${randomNumber} ${path}\n",
    CustomTags: map[string]logger.LogFunc{
        // possibility to adapt or overwrite existing tags
        logger.TagMethod: func(output logger.Buffer, c *fiber.Ctx, data *logger.Data, extraParam string) (int, error) {
            return output.WriteString(utils.ToLower(c.Method()))
        },
        // own tags can be registered
        "randomNumber": func(output logger.Buffer, c *fiber.Ctx, data *logger.Data, extraParam string) (int, error) {
            return output.WriteString(strconv.FormatInt(rand.Int63n(100), 10))
        },
    },
}))
// [17:15:17] 200 -      0s get 10 /test
// [17:15:17] 200 -      0s get 51 /test
app.Use(logger.New(logger.Config{
    // is triggered when the handlers has been processed
    Done: func(c *fiber.Ctx, logString []byte) {
        // allows saving the logging string to other sources
        if c.Response().StatusCode() != fiber.StatusOK {
            reporter.SendToSlack(logString) 
        }
    },
})) 

🧹 Updates

  • Track Configured Values (#2221)
  • Ctx: simplify Protocol() (#2217)
  • Ctx: make Secure() also report whether a secure connection was established to a trusted proxy (#2215)
  • Ctx: update Locals function to accept interface{} key (#2144)
  • Utils: reduce diff to external utils package (#2206)
  • Utils: Update HTTP status codes (#2203)
  • Utils: Replace UnsafeBytes util with suggested way (#2204)
  • Fix and optimize memory storage (#2207)
  • Leverage runtime/debug to print the full stack trace info (#2183)
  • Ci: add check-latest param in vulncheck.yml (#2197)
  • Ci: replace snyk with govulncheck (#2178)

🐛 Fixes

  • Fix naming of routes inside groups (#2199)

📚 Documentation

  • Update list of third-party library licenses (#2211)
  • Update README_zh-CN.md (#2186)
  • Add korean translate in Installation section (#2213)
  • Comment typo (#2173)
  • Cache readme and docs update (#2169)

Full Changelog: v2.39.0...v2.40.0

Thank you @Skyenought, @calebcase, @efectn, @gandaldf, @gmlewis, @jamestiotio, @leonklingele, @li-jin-gou, @marcmartin13, @panjf2000, @pjebs, @rafimuhammad01 and @thor-son for making this update possible.

v2.39.0

23 Oct 08:12
5b1885a
Compare
Choose a tag to compare

🚀 New

🧹 Updates

  • Improve memory storage (#2162)
  • Make IP validation 2x faster (#2158)
  • Switch to text/javascript as per RFC9239 (#2146)
  • Test: add nil jsonDecoder test case (#2139)
  • Utils: update mime extensions (#2133)

🐛 Fixes

  • Unhandled errors and update code comments to help the IDEs (#2128)
  • Multi-byte AppName displays confusion (#2148)
  • Query string parameter pass to fiber context (#2164)
  • Handle multiple X-Forwarded header (#2154)
  • Middleware/proxy - solve data race in middleware/proxy's test (#2153)
  • Middleware/session - Reset d.Data instead of deleting keys in it (#2156)
  • Agent: agent.Struct fails to unmarshal response since 2.33.0 #2134 (#2137)

📚 Documentation

  • Update logger's comment (#2157)
  • Update ReadmeID (#2150)
  • Add doc about usage of CSRF and EncryptCookie middlewares. (#2141)
  • Update language count (#2131)
  • Typos (#2127)

Full Changelog: v2.38.1...v2.39.0

Thank you @Kamandlou, @Yureien, @efectn, @floxydio, @fufuok, @joseroberto, @leonklingele, @li-jin-gou, @marcmartin13, @nathanfaucett, @sadfun, @supakornbabe, @unickorn and @xbt573 for making this update possible.

v2.38.1

26 Sep 11:22
cc1e9bf
Compare
Choose a tag to compare

🚀 New

🧹 Updates

🐛 Fixes

  • Test: fix Test_Ctx_ParamParser route param (#2119)
  • SchemaPasers: Same struct parse param failed (#2101)
  • Fix ctx.SendStream(io.Reader) huge memory usage (#2091)

📚 Documentation

Full Changelog: v2.37.1...v2.38.1

Thank you @Kamandlou, @dayuoba, @efectn, @hakankutluay, @li-jin-gou, @nnnkkk7 and @trim21 for making this update possible.

v2.37.1

08 Sep 05:34
012a2b1
Compare
Choose a tag to compare

🧹 Updates

  • Bump github.com/valyala/fasthttp from 1.39.0 to 1.40.0 (#2075)
  • Unhandled errors in app_test.go (#2071)
  • Unhandled error in hooks test (#2070)

🐛 Fixes

  • Constraints when to use multiple params (#2077)
  • Unhandle in strictmode (#2055)
  • EnvVar middleware parses base64 incorrectly (#2069)

Full Changelog: v2.37.0...v2.37.1

Thank you @Kamandlou, @efectn, @fufuok and @wangjq4214 for making this update possible.

v2.37.0

30 Aug 17:04
1f18ae3
Compare
Choose a tag to compare

🚀 New

🧹 Updates

  • Remove prefork support from custom listeners (#2060)
  • Make IP() and IPs() more reliable (#2020)
  • Bump github.com/valyala/fasthttp from 1.38.0 to 1.39.0 (#2017)
  • Add go 1.19 to tests (#1994)
  • Add black colors to default overriding function (#1993)

🧹 Cleanup

  • Unhandled errors in helpers_test.go (#2058)
  • Unhandled error in common_linux.go (#2056)
  • Handle file error on closing (#2050)
  • Unhandled error in cache package tests (#2049)
  • Unhandled errors and remove unused parameter (#2061)
  • Unhandled errors in tests (#2048)

🐛 Fixes

  • Fix csrf middleware behavior with header key lookup (#2063)
  • Fix regex constraints (#2059)
  • Fix route constraints problems (#2033)
  • Make tlsHandler public to use it with Listener (#2034)
  • Case sensitivity for parameters in GetRouteURL (#2010)
  • Client: fix Agent use after free (#2037)
  • Middleware/monitor - fix ignore custom settings (#2024)
  • Fix proxy overwrote the wrong scheme (#2004)
  • Fix infinitely app.Test (#1997)
  • Fix gopsutil when compiling for bsd (#1995)

📚 Documentation

  • Make Hooks public (#2015)
  • Gofmt & add missing copyright texts (#2013)
  • Change support claim up to go 1.19 (#2043)
  • Update Spanish readme (#2064)
  • Update Italian readme (#2042)
  • Update README.md (#2023)

Thank you @efectn, @Maxi-Mega, @trim21, @GalvinGao, @Kamandlou, @gbolo, @micziz, @mstrYoda, @sixcolors, @solrac97gr, @thomasdseao, @tusharxoxoxo and @wangjq4214 for making this update possible.

v2.37.0-rc.1

18 Aug 14:33
f031e08
Compare
Choose a tag to compare
v2.37.0-rc.1 Pre-release
Pre-release

🚀 New

  • Route constraints (#1998)
  • Add XML to context. (#2003)

🧹 Updates

  • Bump github.com/valyala/fasthttp from 1.38.0 to 1.39.0 (#2017)
  • Add go 1.19 to tests (#1994)
  • Add black colors to default overriding function (#1993)

🐛 Fixes

  • Fix proxy overwrote the wrong scheme (#2004)
  • Fix infinitely app.Test (#1997)
  • Fix gopsutil when compiling for bsd (#1995)

📚 Documentation

  • Make Hooks public (#2015)
  • Gofmt & add missing copyright texts (#2013)

Thank you @Maxi-Mega, @trim21, @efectn and @wangjq4214 for making this update possible.

v2.36.0

02 Aug 06:49
Compare
Choose a tag to compare

🚀 New

🐛 Fixes

  • Padding around app name in startup message when containing non-ascii characters (#1987)
  • Closes #1931 "🤗 How to get path param before a custom verb?" (#1983)

📚 Documentation

  • Translate to Indonesian Awesome List (#1980)

Thank you @Maxi-Mega, @efectn, @radenrishwan and @tohutohu for making this update possible.

v2.35.0

06 Jul 11:03
2a2337d
Compare
Choose a tag to compare

🚀 New

🧹 Updates

  • Binds the param string to a struct use params tag (#1968)
  • Client: Remove beta warning (#1951)
  • Bump github.com/valyala/fasthttp from 1.37.0 to 1.38.0 (#1948)
  • Delete a blank line (#1961)
  • Actions for MacOS (#1911)

🐛 Fixes

  • middleware/logger: TagLatency doesn't have standard format between modes (#1943)
  • middleware/session: fix update cookie. (#1960)

📚 Documentation

  • Refactor - default error handler & example (#1941)
  • New issue templates (#1945)
  • Translate some lines to turkish (#1954)
  • Update README_fa.md (#1953)
  • Flat-square style for readme badges (#1949)

Thank you @efectn, @hamidreza01, @ly020044, @marcelogamba, @nnnkkk7, @olongfen and @taheri24 for making this update possible.

v2.34.1

14 Jun 06:10
b1c3b43
Compare
Choose a tag to compare

🧹 Updates

  • Spliting dump request to add Query (#1909)
  • Refactor favicon middleware, avoid magic numbers. (#1919)

🐛 Fixes

  • Fix GetLocationFromRoute bug for optional params (#1922)

📚 Documentation

  • Fix typo for paramsInt function (#1913)

Thank you @ancogamer, @remotenode, @sujit-baniya and @vikpe for making this update possible.

v2.34.0

23 May 07:19
deb02cb
Compare
Choose a tag to compare

🚀 New

🧹 Updates

  • Bump github.com/valyala/fasthttp from 1.35.0 to 1.37.0 (#1882)
  • z/OS Compatibility (#1904)

Thank you @dranikpg, @jfcg and @philippeleite for making this update possible.