Commit Graph

4127 Commits (main)

Author SHA1 Message Date
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
Juan Calderon-Perez 44b971ace5
Merge pull request #3277 from gofiber/dependabot/go_modules/github.com/mattn/go-colorable-0.1.14
build(deps): bump github.com/mattn/go-colorable from 0.1.13 to 0.1.14
2025-01-13 21:37:29 -05:00
Giovanni Rivera 4e5fea1d7a
🩹 Fix: Fix app.Test() auto-failing when a connection is closed early (#3279)
* ♻️ Refactor: Extract testConn err to variable

* ♻️ Refactor: Extract ErrTestGotEmptyResponse from app.Test()

* 🩹 Fix: Fix `app.Test()` auto-failing when testConn is closed

* 🩹 Fix(app_test.go): Use tab for indent instead of spaces

* 🩹 Fix(app_test.go): Fix to respect gofmt linter

* ♻️ Refactor: Update Drop tests to verify error type
2025-01-13 14:18:03 +01:00
dependabot[bot] 6c7473b842
build(deps): bump github.com/mattn/go-colorable from 0.1.13 to 0.1.14
Bumps [github.com/mattn/go-colorable](https://github.com/mattn/go-colorable) from 0.1.13 to 0.1.14.
- [Commits](https://github.com/mattn/go-colorable/compare/v0.1.13...v0.1.14)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-colorable
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-10 12:46:21 +00:00
RW bc37f209bf
refactor(timeout): unify and enhance timeout middleware (#3275)
* feat(timeout): unify and enhance timeout middleware

- Combine classic context-based timeout with a Goroutine + channel approach
- Support custom error list without additional parameters
- Return fiber.ErrRequestTimeout for timeouts or listed errors

* feat(timeout): unify and enhance timeout middleware

- Combine classic context-based timeout with a Goroutine + channel approach
- Support custom error list without additional parameters
- Return fiber.ErrRequestTimeout for timeouts or listed errors

* refactor(timeout): remove goroutine-based logic and improve documentation

- Switch to a synchronous approach to avoid data races with fasthttp context
- Enhance error handling for deadline and custom errors
- Update comments for clarity and maintainability

* refactor(timeout): add more test cases and handle zero duration case

* refactor(timeout): add more test cases and handle zero duration case

* refactor(timeout): add more test cases and handle zero duration case

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-01-08 08:19:20 +01:00
dependabot[bot] 86d72bbba8
build(deps): bump golang.org/x/crypto from 0.31.0 to 0.32.0 (#3274)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.31.0 to 0.32.0.
- [Commits](https://github.com/golang/crypto/compare/v0.31.0...v0.32.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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-07 19:20:53 +01:00
René a95ffd8eff fix doc examples for generic function 2025-01-06 08:36:06 +01:00
Giovanni Rivera ac82b0c413
📚 Doc: Fix static middleware CacheDuration data type typo (#3273) 2025-01-03 10:36:58 +03:00
M. Efe Çetin 5355869d4d
🐛 bug: make Render bind parameter type any again (#3270)
* 🐛 bug: make Render bind parameter type any again

* update  docs
2025-01-02 08:42:25 +01:00
René d5771a34df prepare release 3.0.0-beta.4 2024-12-31 17:00:40 +01:00
M. Efe Çetin ef04a8a99e
🐛 bug: Fix square bracket notation in Multipart FormData (#3235)
* 🐛 bug: add square bracket notation support to BindMultipart

* Fix golangci-lint issues

* Fixing undef variable

* Fix more lint issues

* test

* update1

* improve coverage

* fix linter

* reduce code duplication

* reduce code duplications in bindMultipart

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: René <rene@gofiber.io>
2024-12-31 16:34:28 +01:00
AuroraTea d0e767fc47
📚 Doc: Optimize the menu item text (#3267) 2024-12-31 15:58:07 +01:00
dependabot[bot] 26e30c0672
build(deps): bump DavidAnson/markdownlint-cli2-action from 18 to 19 (#3266)
Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 18 to 19.
- [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases)
- [Commits](https://github.com/davidanson/markdownlint-cli2-action/compare/v18...v19)

---
updated-dependencies:
- dependency-name: DavidAnson/markdownlint-cli2-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-30 14:18:54 +01:00
Juan Calderon-Perez 845a7f8b8e
🧹 chore: Improve Performance of Fiber Router (#3261)
* Initial improvements

* Update test

* Improve RemoveEscapeChar performance

* Fix lint issues

* Re-add comments

* Add dedicated request handlers

* Fix lint issues

* Add test case for app.All with custom method

* Add test for custom Ctx and Request Methods

* Simplify test logic

* Simplify test
2024-12-29 19:34:34 +01:00
Bulat Bagaviev 775e0a73f3
🩹 Fix: Memory leak removal in the idempotency middleware (#3263)
* 🩹 Fix: Add key removal in MemoryLock

* Fixed concurrent deletion.

* Fix: idempotency middleware's MemoryLock

* Add MemoryLock benchmarks.

* Updated benchmarks: Add returning error handling

* Renamed benchmark: RepeatedKeys

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-12-28 14:29:31 +01:00