Commit Graph

4091 Commits (a46937efe324c6e1c5d1a94e974ce824ae05f4dc)

Author SHA1 Message Date
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
Juan Calderon-Perez 252a0221a0
Merge pull request #3317 from gofiber/improve_docs
docs: Update adapter middleware documentation
2025-02-20 08:26:16 -05:00
René d655e08a48 add more adpater documenation 2025-02-20 13:52:23 +01:00
René cdb862add1 add more adpater documenation 2025-02-20 12:58:08 +01:00
Kashiwa 283ef32196
🩹 Fix: genericParseType parsing large uint leads to overflow (#3315)
* 🩹 Fix: genericParseType parsing large uint leads to overflow

* ♻️ Refactor: use strconv.FormatUint instead of fmt.Sprintf
2025-02-20 12:26:35 +01:00
JIeJaitt b0bc32b534
🩹 Fix: goroutine leakage (#3306) 2025-02-13 08:12:00 +01:00
dependabot[bot] 04c9089f68
build(deps): bump golang.org/x/net from 0.31.0 to 0.33.0 in the go_modules group (#3293)
build(deps): bump golang.org/x/net in the go_modules group

Bumps the go_modules group with 1 update: [golang.org/x/net](https://github.com/golang/net).


Updates `golang.org/x/net` from 0.31.0 to 0.33.0
- [Commits](https://github.com/golang/net/compare/v0.31.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
  dependency-group: go_modules
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-12 19:19:25 +03:00
Juan Calderon-Perez a61c8b3f9d
Merge pull request #3305 from gofiber/dependabot/go_modules/golang.org/x/crypto-0.33.0
build(deps): bump golang.org/x/crypto from 0.32.0 to 0.33.0
2025-02-11 11:33:59 +01:00
dependabot[bot] 53aa3da15c
build(deps): bump golang.org/x/crypto from 0.32.0 to 0.33.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.32.0 to 0.33.0.
- [Commits](https://github.com/golang/crypto/compare/v0.32.0...v0.33.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-10 12:11:38 +00:00
Lars Schumann 6148c6fe29
📚 Doc: Update intro.md Static Files section (#3303)
Update intro.md Static Files section

In v3 the apps Static method has been removed and its functionality has been moved to the static middleware.
The given code example has been updated accordingly.
2025-02-10 08:35:56 +01:00
René 7af9c93f5b add internal architecture docs 2025-02-04 09:17:43 +01:00
René f5b7a12d84 cleanup: remove unused function `IndexRune` 2025-01-30 16:50:20 +01:00
René d0ed605194 fix docs sync bug 2025-01-29 08:30:11 +01:00
René 7dc28a0b45 increase node version for doc sync action 2025-01-29 08:23:24 +01:00
René 17634dab23 Merge remote-tracking branch 'origin/main' 2025-01-29 08:16:13 +01:00
René 4c09b32d14 fix docs for URI Binder 2025-01-29 08:16:03 +01:00
Juan Calderon-Perez 85041cdd77
Merge pull request #3295 from gofiber/dependabot/github_actions/codecov/codecov-action-5.3.1
build(deps): bump codecov/codecov-action from 5.3.0 to 5.3.1
2025-01-28 21:40:18 -05:00
dependabot[bot] c62a98e652
build(deps): bump codecov/codecov-action from 5.3.0 to 5.3.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.3.0 to 5.3.1.
- [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.0...v5.3.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-27 12:25:27 +00:00
dependabot[bot] 2eb6808e29
build(deps): bump codecov/codecov-action from 5.1.2 to 5.3.0 (#3292)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.1.2 to 5.3.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.1.2...v5.3.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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-24 13:38:24 +01:00
miyamo2 8970f515dd
🐛 fix: Align cache middleware with RFC7231 (#3283)
* 🩹 Fix(v3;middleware/cache): don't cache if status code is not cacheable

* allow 418 TeaPot

* fix test

* fix lint error

* check cacheability with map

* documentation

* fix: markdown lint

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-01-20 08:22:51 +01:00
Juan Calderon-Perez aa245aeaec
Merge pull request #3285 from grivera64/docs/add-c-drop-example
📚 Docs: Add `c.Drop()` example to `whats_new.md`
2025-01-19 02:39:19 -05:00
Juan Calderon-Perez 927e3b3266
Update whats_new.md 2025-01-19 02:38:34 -05:00
Giovanni Rivera 1dedc8034c
📚 Docs: Add `c.Drop()` example to `whats_new.md`
- Add Drop section with an example in `whats_new.md`
- Reorder `c.Drop()` and `c.End()` to match source code order
  in `whats_new.md`
2025-01-18 16:53:12 -08:00
Juan Calderon-Perez 156897ee1c
Merge pull request #3284 from aliziyacevik/master
[Maintenance]: Added ctx.Drop() to whats_new.md
2025-01-18 09:41:54 -05:00
aliziyacevik b31184e0b7 Doc: Added missing ctx.Drop() to whats_new.md 2025-01-18 14:31:55 +03:00
Giovanni Rivera a42ddc100e
🔥 feat: Add End() method to Ctx (#3280)
* 🔥 Feature(v3): Add End() method to Ctx

* 🎨 Style(Ctx): Respect linter in tests

* 🚨 Test(End): Add timeout test for c.End()

* 📚 Doc: Update End() documentation examples to use 4 spaces

* 🚨 Test: Update `c.End()` tests to use StatusOK

---------

Co-authored-by: Giovanni Rivera <grivera64@users.noreply.github.com>
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-01-16 11:54:46 +01:00