4175 Commits

Author SHA1 Message Date
Juan Calderon-Perez
fe01057180
Merge branch 'main' into codex/refactor-context-and-routing-interfaces-for-generics 2025-05-25 14:29:22 -04:00
RW
e722d82206
️ Performance optimizations (#3477)
adpater / HTTPHandler
NEW
Benchmark_HTTPHandler-12    	 1762837	       640.6 ns/op	     696 B/op	      10 allocs/op
Benchmark_HTTPHandler-12    	 1924524	       616.5 ns/op	     696 B/op	      10 allocs/op
Benchmark_HTTPHandler-12    	 1838780	       650.4 ns/op	     696 B/op	      10 allocs/op
Benchmark_HTTPHandler-12    	 1876947	       644.0 ns/op	     696 B/op	      10 allocs/op
OLD
Benchmark_HTTPHandler-12    	 1864819	       667.2 ns/op	     720 B/op	      11 allocs/op
Benchmark_HTTPHandler-12    	 1892569	       677.0 ns/op	     720 B/op	      11 allocs/op
Benchmark_HTTPHandler-12    	 1811704	       639.5 ns/op	     720 B/op	      11 allocs/op
Benchmark_HTTPHandler-12    	 1879849	       644.0 ns/op	     720 B/op	      11 allocs/op

Utils / IsNoCache
NEW
Benchmark_Utils_IsNoCache-12    	44307204	        27.08 ns/op	       0 B/op	       0 allocs/op
Benchmark_Utils_IsNoCache-12    	40782919	        26.88 ns/op	       0 B/op	       0 allocs/op
Benchmark_Utils_IsNoCache-12    	44228217	        26.69 ns/op	       0 B/op	       0 allocs/op
Benchmark_Utils_IsNoCache-12    	45605700	        26.75 ns/op	       0 B/op	       0 allocs/op
OLD
Benchmark_Utils_IsNoCache-12    	30043908	        37.80 ns/op	       0 B/op	       0 allocs/op
Benchmark_Utils_IsNoCache-12    	32137476	        37.51 ns/op	       0 B/op	       0 allocs/op
Benchmark_Utils_IsNoCache-12    	31474653	        37.92 ns/op	       0 B/op	       0 allocs/op
Benchmark_Utils_IsNoCache-12    	31838683	        37.71 ns/op	       0 B/op	       0 allocs/op
2025-05-25 17:23:03 +02:00
René
40dea8e606 small optimizations 2025-05-25 16:28:51 +02:00
René
c956f6c35e fix lint issues 2025-05-24 23:53:16 +02:00
RW
4fbcebffd8
Update docs/api/app.md 2025-05-24 23:33:34 +02:00
RW
6da4783013 Make custom context setup via NewWithCustomCtx 2025-05-24 23:32:16 +02:00
RW
9c123ce957
Update conditional instructions for startup skip (#3475)
Clarify conditional startup script skip
2025-05-24 21:31:47 +02:00
RW
f35c14c203
Update AGENTS startup instructions (#3474)
clarify dependency check
2025-05-24 21:00:24 +02:00
dependabot[bot]
3ff2d378ab
build(deps): bump github.com/valyala/fasthttp from 1.60.0 to 1.62.0 (#3440)
* build(deps): bump github.com/valyala/fasthttp from 1.60.0 to 1.62.0

Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.60.0 to 1.62.0.
- [Release notes](https://github.com/valyala/fasthttp/releases)
- [Commits](https://github.com/valyala/fasthttp/compare/v1.60.0...v1.62.0)

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

Signed-off-by: dependabot[bot] <support@github.com>

* Fix CSRF middleware tests for fasthttp 1.62 (#3471)

Fix CSRF tests for fasthttp 1.62

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: RW <rene@gofiber.io>
2025-05-24 11:21:50 +02:00
RW
93e0e0d2a6
Update AGENTS.md 2025-05-23 17:40:12 +02:00
RW
1e893cc798
Update AGENTS.md 2025-05-23 17:33:50 +02:00
Juan Calderon-Perez
895abd5cb4
🧹 chore: Add unit-test for header injection (#3470)
Remove extra header sanitization
2025-05-23 13:48:19 +02:00
RW
aae8892c7e
Improve proxy middleware (#3468) 2025-05-23 10:47:05 +02:00
Juan Calderon-Perez
18ed68b543
🧹 chore: Fix proxy middleware tests for offline environments (#3467)
* Fix proxy middleware tests to avoid external network

* Update proxy_test.go

* Update middleware/proxy/proxy_test.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update proxy_test.go

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-22 14:07:06 +02:00
Juan Calderon-Perez
81edaf094d
🐛 fix: Parsing of IPv6 addresses (#3466)
* Expand Test_Utils_Parse_Address

* Update implementation based on Codex

* Remove duplicated func

* Update test fmt

* format

* Update helpers_test.go

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

* more format

* more format

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-05-22 08:39:12 +02:00
Juan Calderon-Perez
273df5f86b
docs: Fix more typos across code base (#3465)
Revert bound typo fixes
2025-05-21 14:34:36 +02:00
Cory Koch
1f1bd19b61
🔥 feat: Add Support for Removing Routes (#3230)
* 🔥 feat: Add Support for Removing Routes (#3230)

* Add new methods named RemoveRoute and RemoveRouteByName.

* Update register method to prevent duplicate routes.

* Clean up tests

* Update docs

* Update router.go

* Fix markdown

* Some fixes

* update

* test

* fix removing logic

* fix tests

* fix tests

* update docs

* fix tests

* Update docs/api/app.md

* Apply suggestions from code review

* update methods behavior of removeroute

* 🔥 feat: Add Support for Removing Routes #3230

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: Juan Calderon-Perez <jgcalderonperez@protonmail.com>
Co-authored-by: Muhammed Efe Cetin <efectn@protonmail.com>
Co-authored-by: RW <rene@gofiber.io>
2025-05-21 09:45:39 +02:00
Juan Calderon-Perez
fa70d2babc
📒 docs: Fix typos (#3464)
fix typos
2025-05-21 08:12:32 +02:00
RW
cc636b5651
Update AGENTS.md 2025-05-20 07:29:38 +02:00
Manuel de la Peña
80db4de1a5
🔥 feat: Add Support for service dependencies (#3434)
* feat: support for starting devtime dependencies in an abstract manner

* feat: support for starting devtime dependencies in an abstract manner

* fix: spell

* fix: lint

* fix: markdown lint

* fix: b.Helper

* fix: lint spell

* fix: field padding

* chore: protect the usage of dev dependencies with the "dev" build tag

* fix: error message

* docs: fix type name

* fix: mock context cancellation

* docs: simpler

* fix: lint unused receiver

* fix: handle error in benchmarks

* lint: remove build tag

* fix: wrap error

* fix: lint

* fix: explain why lint exclusion

* chore: best effort while terminating dependencies

* gix: lintern name

* fix: reduce flakiness in tests

* chore: get dependency state for logs

* chore: protect dev time tests and benchmarks under build tag

* chore: add build tag in more places

* fix: more conservative context cancellation timeout in tests

* chore: remove build tags

* chore: rename to Services

* fix: update tests

* fix: lint

* fix: lint

* fix: apply coderrabit suggestion

* chore: add more unit tests

* chore: add more unit tests

* chore: refactor tests

* fix: avoid control flags in tests

* chore: consistent error message in start

* chore: simplify error logic

* chore: remove flag coupling

* chore: simplify benchmarks

* chore: add corerabbit suggetion

* fix: wording

* chore: log error on service termination

* docs: wording

* fix: typo in error message

* fix: wording

* fix: panic on startup error

* chore: store started services separately, so that we can terminate them properly

* docs: update example

* fix: use context provider instead of storing the context

* chore: use require.Empty

* fix: no tabs in docs

* chore: move field for better alignment

* docs: do not use interface as method receiver

* docs: proper usage of JSON bind

* fix: use startup context for bootstrap log

* chore: move happy path to the left

* fix: use configured consistently

* chore: terminate started services in reverse order

* fix: consistent access to the config context

* chore: test names and benchmarks location

* chore: benchmark refinement

* chore: store the services into the global State

* chore: add functions to access the Services in the state

* chore: hex-encode the hashes

* chore: consistent var name for services

* chore: non racey service initialisation

* fix: wrong range iteration in service keys

* fix: use inline

* chore: more tests for the generics functions for services

* chore: add benchmarks for service functions

* fix: benchmarks refactor was wrong

* fix. refine error message

* fix: do not cause overhead in newState, instead pre-calculate the prefix hash at init

* chore: simplify hashing

* chore: use smaller, and testable function for initServices

* chore: initialize services in the app.init

* chore: init services before blocking the app init

* Revert "chore: init services before blocking the app init"

This reverts commit bb67cf6380cb71ad5ae4ab4807cdfbf0c7eafa1b.

* chore: move happy path to the left at initServices

* fix: register shutdown hooks for services after app's mutext is unlocked

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-05-19 14:35:13 +02:00
dependabot[bot]
43ed6df227
build(deps): bump github.com/gofiber/schema from 1.3.0 to 1.4.0 (#3462)
Bumps [github.com/gofiber/schema](https://github.com/gofiber/schema) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/gofiber/schema/releases)
- [Commits](https://github.com/gofiber/schema/compare/v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/gofiber/schema
  dependency-version: 1.4.0
  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-05-19 14:33:55 +02:00
Manuel de la Peña
5b6795ff15
📚 Doc: fix AGENTS markdown lint (#3460) 2025-05-19 10:34:33 +02:00
RW
bc6a190afc
Update AGENTS.md 2025-05-18 23:05:38 +02:00
RW
2bab98dedd
Create AGENTS.md 2025-05-18 22:39:31 +02:00
M. Efe Çetin
cf4074f19c
🐛 bug: fix redirection flash messages violate cookie structure (#3457)
* 🐛 bug: fix redirection flash messages violate cookie structure

* fix linter

* add newtestcases

* add testcases
2025-05-18 15:08:03 +02:00
Juan Calderon-Perez
59b9b10488
Merge pull request #3459 from gofiber/dependabot/github_actions/codecov/codecov-action-5.4.3
build(deps): bump codecov/codecov-action from 5.4.2 to 5.4.3
2025-05-16 09:10:42 -04:00
dependabot[bot]
8c07cbe23e
build(deps): bump codecov/codecov-action from 5.4.2 to 5.4.3
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.4.2 to 5.4.3.
- [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.4.2...v5.4.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-16 13:00:43 +00:00
RW
119743b726
🚀 Improve routing treeBuild flow (#3456)
* improve routing treeBuild flow

* improve routing treeBuild flow
2025-05-16 08:30:05 +02:00
Juan Calderon-Perez
fa1f8c970f
Merge pull request #3453 from gofiber/dependabot/github_actions/DavidAnson/markdownlint-cli2-action-20
build(deps): bump DavidAnson/markdownlint-cli2-action from 19 to 20
2025-05-15 09:08:31 -04:00
dependabot[bot]
0b448713af
build(deps): bump github.com/tinylib/msgp from 1.2.5 to 1.3.0 (#3447)
Bumps [github.com/tinylib/msgp](https://github.com/tinylib/msgp) from 1.2.5 to 1.3.0.
- [Release notes](https://github.com/tinylib/msgp/releases)
- [Commits](https://github.com/tinylib/msgp/compare/v1.2.5...v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/tinylib/msgp
  dependency-version: 1.3.0
  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>
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-05-15 14:56:26 +02:00
dependabot[bot]
d924fcff0e
build(deps): bump DavidAnson/markdownlint-cli2-action from 19 to 20
Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 19 to 20.
- [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases)
- [Commits](https://github.com/davidanson/markdownlint-cli2-action/compare/v19...v20)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-15 12:51:20 +00:00
Edvard
71820292b6
🔥 feat: Add All method to Bind (#3373)
* feat: Add All method to Bind

This commit introduces a new `All` method to the `Bind` struct, enabling the binding of request data from multiple sources (URI parameters, body, query parameters, headers, and cookies) into a single struct.

The `All` method iterates through the available binding sources, applying them in a predefined precedence order. It merges the values from each source into the output struct, only updating fields that are currently unset.

Changes:

- Added `All` method to `Bind` struct.
- Added `mergeStruct` helper function to merge struct values.
- Added `isZero` helper function to check if a value is zero.
- Added a test case for the `All` method in `bind_test.go` to validate its functionality.

* feat: Enhance Bind.All with comprehensive testing and configuration

The changes include:

- Added `RequestConfig` struct to encapsulate request configuration (ContentType, Body, Headers, Cookies, Query).
- Implemented `ApplyTo` method on `RequestConfig` to apply the configuration to the context.
- Created multiple test cases for `Bind.All` covering successful binding, missing fields, overriding query parameters, and form binding.
- Added a test case `Test_Bind_All_Uri_Precedence` to validate the precedence of URI parameters.
- Added benchmark test `BenchmarkBind_All` to measure the performance of the `Bind.All` method.
- Refactored the `TestBind_All` to use the new `RequestConfig` and assertion libraries.

* fix: Correct form binding in Test_Bind_All

* refactor: Improve Bind.All test and struct field ordering

- Reordered fields in `RequestConfig` and `User` structs for field alignment
- Updated `Test_Bind_All` to use `require.NoError` for more robust error checking.
- Corrected header key casing in `Test_Bind_All` to `X-User-Role` to match the struct tag.
- Added `t.Parallel()` to the test function to enable parallel test execution.

* feat: Document Bind.All function in API documentation

This commit adds documentation for the `Bind.All` function to the API documentation.

The documentation includes:

- A description of the function's purpose and precedence order for binding data from different sources (URI, body, query, headers, cookies).

* docs: lint Bind.All documentation

* fix: Update parameter tags from 'param' to 'uri' in bind_test.go

* fix: Update parameter tags from 'param' to 'uri' in bind.md

* test: Replace assert with require in bind_test.go

* feat: Add support for unified binding with defined precedence order in whats_new.md

---------

Co-authored-by: RW <rene@gofiber.io>
2025-05-14 15:56:39 +02:00
Jason McNeil
4aae3271af
📝 docs: Document usage of Custom Tags in Logger middleware (#3446)
* 📝 docs: Update logger middleware documentation to include CustomTags for logging Request ID

* 📚 docs: fix markdown lint errors
2025-05-13 08:42:46 +02:00
RW
ab7f949382
📒 docs: Idempotency add more detailed description for next method (#3443)
* add more detailed description for next method
2025-05-12 14:59:42 +02:00
Isaac Andrade
4321dfed55
♻️ refactor: Change c.Redirect() default status (#3415)
* Set default redirect response status to 303 SeeOther

Closes #3405

In some browsers, redirect status 302 Found sometimes is used to change
the HTTP verb of the response from what the user set to what was used in
the request. Changing to 303 SeeOther in the default works more like
expected: it defaults to GET and can be overriden by the user.

* Add tests to Redirect default status change.

* Update docs.

* Fix remaining tests to reflect redirect 303 status as the new default. Reflect that in docs/whats_new.md

* Update redirect_test.go

* Fix code review hints

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: René <rene@gofiber.io>
2025-05-12 14:56:23 +02:00
Yorick de Wid
057647a579
🔥 feat: Add support for ForceColors in Logger middleware (#3428)
* Force the use of terminal colors via config option

* docs: add example for forcing terminal colors in logger middleware

* test: add benchmarks for logger middleware with forced colors

* Add ForceColors field to 'whats new'

* Show example in 'whats new'
2025-05-09 13:58:41 +02:00
KatzuYoru
bfef962d86
🐛 fix: Handling of next param position (#3418)
* fix: the non updating found

* Update path.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* comment: describing the conditional breaking

* fix: incorrect logic in finding the cluster start chars

* refactor:comment update

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: lint issue

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: RW <rene@gofiber.io>
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-05-07 09:16:45 +02:00
Juan Calderon-Perez
ec4b5437e2
Merge pull request #3438 from gofiber/dependabot/go_modules/golang.org/x/crypto-0.38.0
build(deps): bump golang.org/x/crypto from 0.37.0 to 0.38.0
2025-05-06 20:24:02 -04:00
dependabot[bot]
c309971ed1
build(deps): bump golang.org/x/crypto from 0.37.0 to 0.38.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.37.0 to 0.38.0.
- [Commits](https://github.com/golang/crypto/compare/v0.37.0...v0.38.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-06 12:19:16 +00:00
AuroraTea
2ef852e1a9
📚 Doc: Fix examples in middleware/session (#3435)
📚 Doc: Fix example in middleware/session
2025-05-06 08:33:12 +02:00
Muhammad Saleh Solahudin
3f7f48e9f9
🧹 chore: Adjust Funding Custom URL (#3432)
* chore: adjust funding custom url

* chore: adjust funding custom url to github sponsors
2025-05-03 07:46:59 +02:00
Juan Calderon-Perez
85cce3c434
Merge pull request #3413 from gofiber/dependabot/github_actions/codecov/codecov-action-5.4.2
build(deps): bump codecov/codecov-action from 5.4.0 to 5.4.2
2025-04-15 08:15:36 -04:00
dependabot[bot]
9ed1ce1d3e
build(deps): bump codecov/codecov-action from 5.4.0 to 5.4.2
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.4.0 to 5.4.2.
- [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.4.0...v5.4.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-15 12:05:34 +00:00
Jason McNeil
6eba33af25
📒 docs: fix CSRF handler example (#3412)
docs(middleware/csrf): fix handler example
2025-04-15 08:03:30 +02:00
René
1a17500efc repair readme benchmarks 2025-04-13 18:38:39 +02:00
René
eebe63dfd5 update benchmarks.md 2025-04-09 15:38:57 +02:00
Jason McNeil
b3e84860d2
Revert "🔥 feat: Add Context Support to RequestID Middleware" (#3365)
Revert "🔥 feat: Add Context Support to RequestID Middleware (#3200)"

This reverts commit f725ded92bac13e773f92ff478e1a461c160abd3.

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-04-08 08:59:24 +02:00
dependabot[bot]
417dffed0e
build(deps): bump golang.org/x/crypto from 0.36.0 to 0.37.0 (#3395)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.36.0 to 0.37.0.
- [Commits](https://github.com/golang/crypto/compare/v0.36.0...v0.37.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.37.0
  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-04-08 08:58:31 +02:00
René
551570326c fix go 1.24 toolchain problem 2025-04-03 14:31:59 +02:00
dependabot[bot]
694f0d77d6
build(deps): bump github.com/valyala/fasthttp from 1.59.0 to 1.60.0 (#3391)
Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.59.0 to 1.60.0.
- [Release notes](https://github.com/valyala/fasthttp/releases)
- [Commits](https://github.com/valyala/fasthttp/compare/v1.59.0...v1.60.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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-03 14:11:29 +02:00