Commit Graph

4116 Commits (fix-lint)

Author SHA1 Message Date
Juan Calderon-Perez d4647364fc Remove duplicated rule 2025-03-16 22:25:41 -04:00
Juan Calderon-Perez 4e524bc14f Update golangci-lint config 2025-03-16 22:17:06 -04:00
Juan Calderon-Perez bdb405eb5b Enable SA4023 2025-03-16 20:10:08 -04:00
Juan Calderon-Perez 0a225b8f43
Update golangci-lint version 2025-03-16 11:40:15 -04:00
Juan Calderon-Perez e54d8a1faa
Merge pull request #3355 from ldez/fix-lint-fix
🧹 chore: Fix and update golangci-lint workflow
2025-03-15 22:02:47 -04:00
Fernandez Ludovic 84dfb4ee17 fix: golangci-lint install 2025-03-16 00:08:24 +01:00
Fernandez Ludovic efeffa84f8 fix: better configuration 2025-03-16 00:08:24 +01:00
Fernandez Ludovic e29633807c fix: directives and spaces 2025-03-15 23:49:58 +01:00
Juan Calderon-Perez 84876bd68a
Update linter.yml 2025-03-15 10:40:58 -04:00
Juan Calderon-Perez 1b2e09ad4e
Try skipping golangci-lint cache 2025-03-15 10:37:48 -04:00
Juan Calderon-Perez b71459e1da Merge branch 'fix-lint' of github.com:gofiber/fiber into fix-lint 2025-03-15 10:25:16 -04:00
Juan Calderon-Perez f83c100075 Bump golang.org/x/net to v0.36.0 2025-03-15 10:25:03 -04:00
Juan Calderon-Perez 9999198d5c
Merge branch 'main' into fix-lint 2025-03-15 10:23:38 -04:00
Juan Calderon-Perez 86818a22c9 Fix linter workflow failures 2025-03-15 10:22:11 -04:00
Juan Calderon-Perez b56a141d59
docs: Update helmet.md default values (#3350)
Update helmet.md
2025-03-14 07:51:34 +01:00
Juan Calderon-Perez ef4437cd65
Merge pull request #3348 from devhaozi/patch-1
docs: Update Helmet Middleware default values
2025-03-12 19:20:10 -04:00
耗子 eb7b00b4fb
fix: default value comment 2025-03-13 01:44:57 +08:00
JIeJaitt c0599ee1d4
🔥 feat: Add Skip function to logger middleware (#3333)
* 🔥 Feature(logger): Add Filter option to logger middleware

* 📚 Doc(logger): Clarify Filter middleware description

* 🚨 Test(logger): Enhance logger filter test with parallel subtests

* 🔒 Test(logger): Add mutex to prevent race conditions in logger test

* 🔥 Feature(logger): Add Filter option to logger middleware

* 📚 Doc(logger): Clarify Filter middleware description

* 🚨 Test(logger): Enhance logger filter test with parallel subtests

* 🔒 Test(logger): Add mutex to prevent race conditions in logger test

* 🚨 Test(logger): Refactor logger test to improve test isolation

* Fix issue with unit-tests

* Update middleware/logger/logger_test.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Apply logger filter as soon as possible

* 📚 Doc: Add logger filter configuration example to whats_new.md

* 📚 Doc: Update logger filter documentation in whats_new.md

* 📚 Doc: Update logger filter documentation and examples

* 🩹 Fix: improve what_new.md

* Update logic for Filter() in Logger middleware. Add more unit-tests

* Rename fields to match expressjs/morgan

* Update middleware/logger/default_logger.go

---------

Co-authored-by: Juan Calderon-Perez <jgcalderonperez@protonmail.com>
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: RW <rene@gofiber.io>
2025-03-10 09:06:11 +01:00
Kashiwa 1b26cf6b5e
♻️ Refactor: optimize routeParser by using sync.Pool (#3343)
* ♻️ Refactor: add routerParser pool

```
goos: linux
goarch: amd64
pkg: github.com/gofiber/fiber/v3
cpu: AMD EPYC 9J14 96-Core Processor
                                                                               │   ori.txt   │              pool.txt               │
                                                                               │   sec/op    │   sec/op     vs base                │
_RoutePatternMatch//api/v1/const_|_match_|_/api/v1/const-16                      173.9n ± 0%   159.3n ± 1%   -8.37% (p=0.000 n=20)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1-16                        163.9n ± 0%   150.9n ± 0%   -7.90% (p=0.000 n=20)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/-16                       165.4n ± 1%   150.6n ± 1%   -8.95% (p=0.000 n=20)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/something-16              174.9n ± 0%   160.6n ± 0%   -8.15% (p=0.000 n=20)
_RoutePatternMatch//api/:param/fixedEnd_|_match_|_/api/abc/fixedEnd-16           520.2n ± 0%   438.1n ± 1%  -15.78% (p=0.000 n=20)
_RoutePatternMatch//api/:param/fixedEnd_|_not_match_|_/api/abc/def/fixedEnd-16   521.8n ± 0%   436.8n ± 0%  -16.29% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity-16                  630.0n ± 0%   525.0n ± 0%  -16.67% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/-16                 633.3n ± 0%   526.4n ± 0%  -16.89% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/1-16                627.8n ± 0%   527.5n ± 0%  -15.97% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v-16                      602.1n ± 0%   501.9n ± 0%  -16.65% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v2-16                     604.9n ± 0%   504.3n ± 0%  -16.62% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v1/-16                    616.7n ± 0%   512.8n ± 1%  -16.86% (p=0.000 n=20)
geomean                                                                          390.5n        336.5n       -13.84%

                                                                               │  ori.txt   │              pool.txt              │
                                                                               │    B/op    │    B/op     vs base                │
_RoutePatternMatch//api/v1/const_|_match_|_/api/v1/const-16                      152.0 ± 0%   144.0 ± 0%   -5.26% (p=0.000 n=20)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1-16                        144.0 ± 0%   136.0 ± 0%   -5.56% (p=0.000 n=20)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/-16                       144.0 ± 0%   136.0 ± 0%   -5.56% (p=0.000 n=20)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/something-16              160.0 ± 0%   152.0 ± 0%   -5.00% (p=0.000 n=20)
_RoutePatternMatch//api/:param/fixedEnd_|_match_|_/api/abc/fixedEnd-16           440.0 ± 0%   368.0 ± 0%  -16.36% (p=0.000 n=20)
_RoutePatternMatch//api/:param/fixedEnd_|_not_match_|_/api/abc/def/fixedEnd-16   440.0 ± 0%   368.0 ± 0%  -16.36% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity-16                  536.0 ± 0%   432.0 ± 0%  -19.40% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/-16                 536.0 ± 0%   432.0 ± 0%  -19.40% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/1-16                536.0 ± 0%   432.0 ± 0%  -19.40% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v-16                      528.0 ± 0%   424.0 ± 0%  -19.70% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v2-16                     528.0 ± 0%   424.0 ± 0%  -19.70% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v1/-16                    528.0 ± 0%   424.0 ± 0%  -19.70% (p=0.000 n=20)
geomean                                                                          337.9        288.8       -14.52%

                                                                               │   ori.txt   │              pool.txt              │
                                                                               │  allocs/op  │ allocs/op   vs base                │
_RoutePatternMatch//api/v1/const_|_match_|_/api/v1/const-16                       5.000 ± 0%   4.000 ± 0%  -20.00% (p=0.000 n=20)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1-16                         5.000 ± 0%   4.000 ± 0%  -20.00% (p=0.000 n=20)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/-16                        5.000 ± 0%   4.000 ± 0%  -20.00% (p=0.000 n=20)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/something-16               5.000 ± 0%   4.000 ± 0%  -20.00% (p=0.000 n=20)
_RoutePatternMatch//api/:param/fixedEnd_|_match_|_/api/abc/fixedEnd-16           13.000 ± 0%   9.000 ± 0%  -30.77% (p=0.000 n=20)
_RoutePatternMatch//api/:param/fixedEnd_|_not_match_|_/api/abc/def/fixedEnd-16   13.000 ± 0%   9.000 ± 0%  -30.77% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity-16                  14.000 ± 0%   9.000 ± 0%  -35.71% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/-16                 14.000 ± 0%   9.000 ± 0%  -35.71% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/1-16                14.000 ± 0%   9.000 ± 0%  -35.71% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v-16                      14.000 ± 0%   9.000 ± 0%  -35.71% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v2-16                     14.000 ± 0%   9.000 ± 0%  -35.71% (p=0.000 n=20)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v1/-16                    14.000 ± 0%   9.000 ± 0%  -35.71% (p=0.000 n=20)
geomean                                                                           9.811        6.868       -29.99%
```

* 🩹 Fix: golangci-lint problem
2025-03-10 09:04:04 +01:00
Kashiwa 600ebd95ce
♻️ Refactor: replace isInCharset with bytes.IndexByte (#3342) 2025-03-07 15:33:22 +01:00
vinicius 4177ab4086
🔥 feat: Add support for context.Context in keyauth middleware (#3287)
* feat(middleware): add support to context.Context in keyauth middleware

pretty straightforward option to use context.Context instead of just
fiber.Ctx, tests added accordingly.

* fix(middleware): include import that was missing from previous commit

* fix(middleware): include missing import

* Replace logger with panic

* Update keyauth_test.go

* Update keyauth_test.go

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-03-07 08:23:24 +01:00
Juan Calderon-Perez 208b9e36ba
Merge pull request #3341 from gofiber/dependabot/go_modules/golang.org/x/crypto-0.36.0
build(deps): bump golang.org/x/crypto from 0.35.0 to 0.36.0
2025-03-06 07:43:17 -05:00
dependabot[bot] 6a9cd7d212
build(deps): bump golang.org/x/crypto from 0.35.0 to 0.36.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.35.0 to 0.36.0.
- [Commits](https://github.com/golang/crypto/compare/v0.35.0...v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-06 12:29:49 +00:00
Kashiwa 6953325df5
♻️ Refactor: replace findLastCharsetPosition with strings.LastIndexByte (#3338)
* ♻️ Refactor: replace findLastCharsetPosition with strings.LastIndexByte

* 🩹 Fix: correct loop condition in Go benchmark
2025-03-06 09:00:18 +01:00
RW a5c7b77aec
Update release.yml 2025-03-05 15:08:00 +01:00
RW a46937efe3
Update release-drafter.yml 2025-03-05 15:07:49 +01:00
nickajacks1 64c1771c26
🔥 Feature: Add Req and Res API (#2894)
* 🔥 feat: add Req and Res interfaces

Split the existing Ctx API into two separate APIs for Requests and
Responses. There are two goals to this change:

1. Reduce cognitive load by making it more obvious whether a Ctx method
   interacts with the request or the response.
2. Increase API parity with Express.

* fix(req,res): several issues

* Sprinkle in calls to Req() and Res() to a few unit tests
* Fix improper initialization caught by ^
* Add a few missing methods

* docs: organize Ctx methods by request and response

* feat(req,res): sync more missed methods

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-03-05 08:01:43 +01:00
耗子 8e54c8f938
🐛 fix: Update binder in form_test (#3336)
* Fix: error binder in form_test

* fix: form tag

* Fix: error package name
2025-03-04 05:46:05 +01:00
Kashiwa 9e6f4fd408
♻️ Refactor: reduce the memory usage of RoutePatternMatch (#3335)
* ♻️ Refactor: improve RoutePatternMatch by adding RemoveEscapeCharBytes

```
goos: linux
goarch: amd64
pkg: github.com/gofiber/fiber/v3
cpu: AMD EPYC 7763 64-Core Processor
                                                                              │ route_pattern_match_old.txt │    route_pattern_match_new.txt     │
                                                                              │           sec/op            │   sec/op     vs base               │
_RoutePatternMatch//api/v1/const_|_match_|_/api/v1/const-4                                      263.4n ± 2%   249.0n ± 4%  -5.47% (p=0.001 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1-4                                        258.7n ± 4%   244.7n ± 2%  -5.43% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/-4                                       254.6n ± 4%   246.3n ± 2%  -3.26% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/something-4                              265.1n ± 4%   255.6n ± 3%  -3.60% (p=0.001 n=10)
_RoutePatternMatch//api/:param/fixedEnd_|_match_|_/api/abc/fixedEnd-4                           775.9n ± 3%   775.6n ± 2%       ~ (p=0.424 n=10)
_RoutePatternMatch//api/:param/fixedEnd_|_not_match_|_/api/abc/def/fixedEnd-4                   796.7n ± 3%   767.1n ± 2%  -3.72% (p=0.001 n=10)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity-4                                  916.2n ± 1%   904.8n ± 3%       ~ (p=0.052 n=10)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/-4                                 913.8n ± 4%   909.1n ± 3%       ~ (p=0.393 n=10)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/1-4                                915.0n ± 3%   907.2n ± 2%       ~ (p=0.165 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v-4                                      917.5n ± 2%   876.7n ± 2%  -4.46% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v2-4                                     918.5n ± 2%   886.8n ± 2%  -3.45% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v1/-4                                    935.6n ± 2%   901.9n ± 2%  -3.60% (p=0.000 n=10)
geomean                                                                                         588.3n        570.7n       -2.99%

                                                                              │ route_pattern_match_old.txt │     route_pattern_match_new.txt      │
                                                                              │            B/op             │    B/op     vs base                  │
_RoutePatternMatch//api/v1/const_|_match_|_/api/v1/const-4                                       168.0 ± 0%   152.0 ± 0%   -9.52% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1-4                                         160.0 ± 0%   144.0 ± 0%  -10.00% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/-4                                        160.0 ± 0%   144.0 ± 0%  -10.00% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/something-4                               176.0 ± 0%   160.0 ± 0%   -9.09% (p=0.000 n=10)
_RoutePatternMatch//api/:param/fixedEnd_|_match_|_/api/abc/fixedEnd-4                            440.0 ± 0%   440.0 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/:param/fixedEnd_|_not_match_|_/api/abc/def/fixedEnd-4                    464.0 ± 0%   440.0 ± 0%   -5.17% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity-4                                   536.0 ± 0%   536.0 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/-4                                  536.0 ± 0%   536.0 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/1-4                                 536.0 ± 0%   536.0 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v-4                                       544.0 ± 0%   528.0 ± 0%   -2.94% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v2-4                                      544.0 ± 0%   528.0 ± 0%   -2.94% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v1/-4                                     544.0 ± 0%   528.0 ± 0%   -2.94% (p=0.000 n=10)
geomean                                                                                          353.7        337.9        -4.47%
¹ all samples are equal

                                                                              │ route_pattern_match_old.txt │     route_pattern_match_new.txt      │
                                                                              │          allocs/op          │ allocs/op   vs base                  │
_RoutePatternMatch//api/v1/const_|_match_|_/api/v1/const-4                                       6.000 ± 0%   5.000 ± 0%  -16.67% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1-4                                         6.000 ± 0%   5.000 ± 0%  -16.67% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/-4                                        6.000 ± 0%   5.000 ± 0%  -16.67% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/something-4                               6.000 ± 0%   5.000 ± 0%  -16.67% (p=0.000 n=10)
_RoutePatternMatch//api/:param/fixedEnd_|_match_|_/api/abc/fixedEnd-4                            13.00 ± 0%   13.00 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/:param/fixedEnd_|_not_match_|_/api/abc/def/fixedEnd-4                    14.00 ± 0%   13.00 ± 0%   -7.14% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity-4                                   14.00 ± 0%   14.00 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/-4                                  14.00 ± 0%   14.00 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/1-4                                 14.00 ± 0%   14.00 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v-4                                       15.00 ± 0%   14.00 ± 0%   -6.67% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v2-4                                      15.00 ± 0%   14.00 ± 0%   -6.67% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v1/-4                                     15.00 ± 0%   14.00 ± 0%   -6.67% (p=0.000 n=10)
geomean                                                                                          10.67        9.811        -8.08%
¹ all samples are equal
```

* ♻️ Refactor: returned type of analyseParameterPart and analyseConstantPart

```
goos: linux
goarch: amd64
pkg: github.com/gofiber/fiber/v3
cpu: AMD EPYC 7763 64-Core Processor
                                                                              │ route_pattern_match_old.txt │    route_pattern_match_new3.txt    │
                                                                              │           sec/op            │   sec/op     vs base               │
_RoutePatternMatch//api/v1/const_|_match_|_/api/v1/const-4                                      264.3n ± 2%   253.8n ± 2%  -3.95% (p=0.001 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1-4                                        258.5n ± 1%   247.6n ± 2%  -4.24% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/-4                                       260.8n ± 3%   249.7n ± 4%  -4.26% (p=0.003 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/something-4                              265.4n ± 2%   256.1n ± 2%  -3.49% (p=0.000 n=10)
_RoutePatternMatch//api/:param/fixedEnd_|_match_|_/api/abc/fixedEnd-4                           783.8n ± 2%   777.5n ± 3%       ~ (p=0.218 n=10)
_RoutePatternMatch//api/:param/fixedEnd_|_not_match_|_/api/abc/def/fixedEnd-4                   797.8n ± 1%   773.6n ± 3%  -3.03% (p=0.001 n=10)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity-4                                  920.3n ± 2%   926.0n ± 3%       ~ (p=0.896 n=10)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/-4                                 920.4n ± 4%   908.2n ± 2%       ~ (p=0.063 n=10)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/1-4                                927.9n ± 2%   919.0n ± 3%       ~ (p=0.579 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v-4                                      920.4n ± 3%   889.5n ± 3%  -3.36% (p=0.007 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v2-4                                     916.9n ± 2%   891.9n ± 2%  -2.73% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v1/-4                                    938.8n ± 5%   891.2n ± 2%  -5.07% (p=0.000 n=10)
geomean                                                                                         591.7n        575.5n       -2.73%

                                                                              │ route_pattern_match_old.txt │     route_pattern_match_new3.txt     │
                                                                              │            B/op             │    B/op     vs base                  │
_RoutePatternMatch//api/v1/const_|_match_|_/api/v1/const-4                                       168.0 ± 0%   152.0 ± 0%   -9.52% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1-4                                         160.0 ± 0%   144.0 ± 0%  -10.00% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/-4                                        160.0 ± 0%   144.0 ± 0%  -10.00% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/something-4                               176.0 ± 0%   160.0 ± 0%   -9.09% (p=0.000 n=10)
_RoutePatternMatch//api/:param/fixedEnd_|_match_|_/api/abc/fixedEnd-4                            440.0 ± 0%   440.0 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/:param/fixedEnd_|_not_match_|_/api/abc/def/fixedEnd-4                    464.0 ± 0%   440.0 ± 0%   -5.17% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity-4                                   536.0 ± 0%   536.0 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/-4                                  536.0 ± 0%   536.0 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/1-4                                 536.0 ± 0%   536.0 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v-4                                       544.0 ± 0%   528.0 ± 0%   -2.94% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v2-4                                      544.0 ± 0%   528.0 ± 0%   -2.94% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v1/-4                                     544.0 ± 0%   528.0 ± 0%   -2.94% (p=0.000 n=10)
geomean                                                                                          353.7        337.9        -4.47%
¹ all samples are equal

                                                                              │ route_pattern_match_old.txt │     route_pattern_match_new3.txt     │
                                                                              │          allocs/op          │ allocs/op   vs base                  │
_RoutePatternMatch//api/v1/const_|_match_|_/api/v1/const-4                                       6.000 ± 0%   5.000 ± 0%  -16.67% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1-4                                         6.000 ± 0%   5.000 ± 0%  -16.67% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/-4                                        6.000 ± 0%   5.000 ± 0%  -16.67% (p=0.000 n=10)
_RoutePatternMatch//api/v1/const_|_not_match_|_/api/v1/something-4                               6.000 ± 0%   5.000 ± 0%  -16.67% (p=0.000 n=10)
_RoutePatternMatch//api/:param/fixedEnd_|_match_|_/api/abc/fixedEnd-4                            13.00 ± 0%   13.00 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/:param/fixedEnd_|_not_match_|_/api/abc/def/fixedEnd-4                    14.00 ± 0%   13.00 ± 0%   -7.14% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity-4                                   14.00 ± 0%   14.00 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/-4                                  14.00 ± 0%   14.00 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/v1/:param/*_|_match_|_/api/v1/entity/1-4                                 14.00 ± 0%   14.00 ± 0%        ~ (p=1.000 n=10) ¹
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v-4                                       15.00 ± 0%   14.00 ± 0%   -6.67% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v2-4                                      15.00 ± 0%   14.00 ± 0%   -6.67% (p=0.000 n=10)
_RoutePatternMatch//api/v1/:param/*_|_not_match_|_/api/v1/-4                                     15.00 ± 0%   14.00 ± 0%   -6.67% (p=0.000 n=10)
geomean                                                                                          10.67        9.811        -8.08%
¹ all samples are equal
```

---------

Co-authored-by: RW <rene@gofiber.io>
2025-03-03 08:31:20 +01:00
Kashiwa 6afba957f1
🩹 Fix: sorting error in sortAcceptedTypes (#3331)
* 🩹 Fix: correct sorting error in sortAcceptedTypes.

* ♻️ Refactor: remove redundant branch

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-03-01 18:14:50 +01:00
Juan Calderon-Perez 86cf80630b
Merge pull request #3334 from gofiber/dependabot/github_actions/codecov/codecov-action-5.4.0
build(deps): bump codecov/codecov-action from 5.3.1 to 5.4.0
2025-02-27 07:47:15 -05:00
dependabot[bot] 8e395fd4e3
build(deps): bump codecov/codecov-action from 5.3.1 to 5.4.0
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.3.1 to 5.4.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v5.3.1...v5.4.0)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-27 12:36:56 +00:00
Giovanni Rivera b568915b70
📚 docs: Add Retry Addon documentation (#3330)
* 📚 Doc: Add addon tab to /docs

* 📚 Doc: Add retry to addon docs

* 📚 Doc: Update retry README.md

* 🎨 Styles: Update addon/retry docs to respect markdownlint-cli2

* 📚 Doc: Update addon tab description to be singular

* 📚 Doc: Use retry prefix in retry docs

* 📚 Doc: Add retry addon to whats_new.md

* 🎨 Styles: Update whats_new.md to respect markdownlint-cli2
2025-02-27 08:46:41 +01:00
René 0bf0353a13 Merge remote-tracking branch 'origin/main' 2025-02-27 08:45:58 +01:00
René 47e9c8fa6d only run benchmark when golang files are changed 2025-02-27 08:45:47 +01:00
M. Efe Çetin bc4c920ea6
bind: add support for multipart file binding (#3309)
* deps: update schema to v1.3.0

* bind: add support for multipart file binding

* bind: fix linter

* improve coverage

* fix linter

* add test cases

---------

Co-authored-by: René <rene@gofiber.io>
2025-02-25 19:45:19 +01:00
dependabot[bot] d6d48d8cb7
build(deps): bump github.com/gofiber/schema from 1.2.0 to 1.3.0 (#3308)
Bumps [github.com/gofiber/schema](https://github.com/gofiber/schema) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/gofiber/schema/releases)
- [Commits](https://github.com/gofiber/schema/compare/v1.2.0...v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/gofiber/schema
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-25 17:12:25 +01:00
Kashiwa 435fa42360
♻️ Refactor: Migrate randString to rand v2 (#3329)
* ♻️ Refactor: migrate randString to rand/v2

* 🩹 Fix: golangci-lint
2025-02-25 17:11:46 +01:00
Juan Calderon-Perez 3f935551ea
Merge pull request #3327 from gofiber/dependabot/go_modules/golang.org/x/crypto-0.35.0
build(deps): bump golang.org/x/crypto from 0.33.0 to 0.35.0
2025-02-25 07:41:53 -05:00
Juan Calderon-Perez e47c37f8f2 Run go mod tidy 2025-02-25 07:35:13 -05:00
dependabot[bot] 38ffe73243
build(deps): bump golang.org/x/crypto from 0.33.0 to 0.35.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.33.0 to 0.35.0.
- [Commits](https://github.com/golang/crypto/compare/v0.33.0...v0.35.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-25 00:33:01 +00:00
Juan Calderon-Perez c85ec75fe6
🧹 chore: Add go1.24 to CI matrix (#3325)
* Add go1.24 to CI matrix

* Create codecov.yml

* Lower coverage threshold to 0.5%
2025-02-24 21:24:50 +01:00
RW a7bf8171b1
🐛 bug: Fix handler order in routing (#3321)
* fix handler order in routing
#3312

* fix handler order in routing
#3312

* fix handler order in routing
#3312

* fix handler order in routing
#3312

* fix handler order in routing
#3312

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-02-24 08:14:19 +01:00
Kashiwa 0d1ade4626
♻️ Refactor: Improve Performance of getSplicedStrList (#3318)
* ♻️ Refactor: improve performance of getSplicedStrList

goos: linux
goarch: amd64
pkg: github.com/gofiber/fiber/v3
cpu: AMD EPYC 7763 64-Core Processor
                           │   old.txt   │               new.txt               │
                           │   sec/op    │   sec/op     vs base                │
_Utils_GetSplicedStrList-4   66.12n ± 1%   51.05n ± 1%  -22.79% (p=0.000 n=50)

                           │  old.txt   │            new.txt             │
                           │    B/op    │    B/op     vs base            │
_Utils_GetSplicedStrList-4   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=50) ¹
¹ all samples are equal

                           │  old.txt   │            new.txt             │
                           │ allocs/op  │ allocs/op   vs base            │
_Utils_GetSplicedStrList-4   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=50) ¹
¹ all samples are equal

* 🚨 Test: add more test for getSplicedStrList

* 🩹 Fix: golangci-lint ifElseChain

* ♻️ Refactor: use more descriptive variable names
2025-02-24 08:13:47 +01:00
Kashiwa ef4effc8a0
♻️ Refactor: Reduce the Memory Usage of ignoreHeaders (#3322)
♻️ Refactor: reduce the memory usage of ignoreHeaders

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-02-24 08:12:47 +01:00
Kashiwa b1e858bc76
♻️ Refactor: the value of map is unused in uniqueRouteStack (#3320)
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-02-24 08:12:05 +01:00
Juan Calderon-Perez 5b0a96e4f9
Merge pull request #3314 from gofiber/dependabot/go_modules/github.com/valyala/fasthttp-1.59.0
build(deps): bump github.com/valyala/fasthttp from 1.58.0 to 1.59.0
2025-02-23 16:31:41 -05:00
Juan Calderon-Perez e7c1b3e5e2
Add new config option 2025-02-23 16:00:39 -05:00
dependabot[bot] 856537ef01
build(deps): bump github.com/valyala/fasthttp from 1.58.0 to 1.59.0
Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.58.0 to 1.59.0.
- [Release notes](https://github.com/valyala/fasthttp/releases)
- [Commits](https://github.com/valyala/fasthttp/compare/v1.58.0...v1.59.0)

---
updated-dependencies:
- dependency-name: github.com/valyala/fasthttp
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-23 20:56:57 +00:00
JIeJaitt 4b62d3d592
🔥 feat: Improve and Optimize ShutdownWithContext Func (#3162)
* feat: Optimize ShutdownWithContext method in app.go

- Reorder mutex lock acquisition to the start of the function
- Early return if server is not running
- Use defer for executing shutdown hooks
- Simplify nil check for hooks
- Remove TODO comment

This commit improves the readability, robustness, and execution order
of the shutdown process. It ensures consistent state throughout the
shutdown and guarantees hook execution even in error cases.

* feat: Enhance ShutdownWithContext test for improved reliability

- Add shutdown hook verification
- Implement better synchronization with channels
- Improve error handling and assertions
- Adjust timeouts for more consistent results
- Add server state check after shutdown attempt
- Include comments explaining expected behavior

This commit improves the comprehensiveness and reliability of the
ShutdownWithContext test, ensuring proper verification of shutdown
hooks, timeout behavior, and server state during long-running requests.

* 📚 Doc: update the docs to explain shutdown & hook execution order

* 🩹 Fix: Possible Data Race on shutdownHookCalled Variable

* 🩹 Fix: Remove the default Case

* 🩹 Fix: Import sync/atomic

* 🩹 Fix: golangci-lint problem

* 🎨 Style: add block in api.md

* 🩹 Fix: go mod tidy

* feat: Optimize ShutdownWithContext method in app.go

- Reorder mutex lock acquisition to the start of the function
- Early return if server is not running
- Use defer for executing shutdown hooks
- Simplify nil check for hooks
- Remove TODO comment

This commit improves the readability, robustness, and execution order
of the shutdown process. It ensures consistent state throughout the
shutdown and guarantees hook execution even in error cases.

* feat: Enhance ShutdownWithContext test for improved reliability

- Add shutdown hook verification
- Implement better synchronization with channels
- Improve error handling and assertions
- Adjust timeouts for more consistent results
- Add server state check after shutdown attempt
- Include comments explaining expected behavior

This commit improves the comprehensiveness and reliability of the
ShutdownWithContext test, ensuring proper verification of shutdown
hooks, timeout behavior, and server state during long-running requests.

* 📚 Doc: update the docs to explain shutdown & hook execution order

* 🩹 Fix: Possible Data Race on shutdownHookCalled Variable

* 🩹 Fix: Remove the default Case

* 🩹 Fix: Import sync/atomic

* 🩹 Fix: golangci-lint problem

* 🎨 Style: add block in api.md

* 🩹 Fix: go mod tidy

* ♻️ Refactor: replaced OnShutdown  by OnPreShutdown and OnPostShutdown

* ♻️ Refactor: streamline post-shutdown hook execution in graceful shutdown process

* 🚨 Test: add test for gracefulShutdown

* 🔥 Feature: Using executeOnPreShutdownHooks and executeOnPostShutdownHooks Instead of OnShutdownSuccess and OnShutdownError

* 🩹 Fix: deal Listener err

* 🩹 Fix: go lint error

* 🩹 Fix: reduced memory alignment

* 🩹 Fix: reduced memory alignment

* 🩹 Fix: context should be created inside the concatenation.

* 📚 Doc: update what_new.md and hooks.md

* ♻️ Refactor: use blocking channel instead of time.Sleep

* 🩹 Fix: Improve synchronization in error propagation test.

* 🩹 Fix: Replace sleep with proper synchronization.

* 🩹 Fix: Server but not shut down properly

* 🩹 Fix: Using channels to synchronize and pass results

* 🩹 Fix: timeout with long running request

* 📚 Doc: remove OnShutdownError and OnShutdownSuccess from fiber.md

* Update hooks.md

* 🚨 Test: Add graceful shutdown timeout error test case

* 📝 Doc: Restructure hooks documentation for OnPreShutdown and OnPostShutdown

* 📝 Doc: Remove extra whitespace in hooks documentation

---------

Co-authored-by: yingjie.huang <yingjie.huang@fosunhn.net>
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-02-22 17:32:51 +01:00