4248 Commits

Author SHA1 Message Date
Juan Calderon-Perez
b29171ce40
🧹 chore: Improve CORS middleware response headers (#3505)
* Improve CORS middleware

* 🐛 fix: Remove unused 'slices' import from CORS middleware

---------

Co-authored-by: Jason McNeil <sixcolors@mac.com>
2025-06-10 08:47:34 +02:00
Jason McNeil
73e919621b
📒 docs: Enhance CORS middleware documentation with preflight request details and infrastructure considerations (#3509)
* docs: Enhance CORS middleware documentation with preflight request details and infrastructure considerations

* docs: Update CORS middleware documentation with infrastructure handling options and best practices

* docs: fix CORS middleware documentation markdown linting issues
2025-06-10 08:46:19 +02:00
Juan Calderon-Perez
3a60cf7a4e
🧹 chore: Refactor EnvVar middleware (#3513)
* remove ExcludeVars option

* Simplify envvar export logic
2025-06-10 08:40:58 +02:00
Juan Calderon-Perez
f00e35529c
Merge pull request #3504 from gofiber/dependabot/go_modules/github.com/gofiber/schema-1.5.0
build(deps): bump github.com/gofiber/schema from 1.4.0 to 1.5.0
2025-06-07 16:39:56 -04:00
Juan Calderon-Perez
0523b6a1c7
Merge pull request #3506 from gofiber/dependabot/go_modules/golang.org/x/crypto-0.39.0
build(deps): bump golang.org/x/crypto from 0.38.0 to 0.39.0
2025-06-07 16:38:37 -04:00
Juan Calderon-Perez
80f4f99c01
🧹 chore: Fix typos in code and docs (#3507)
chore: fix spelling mistakes across codebase
2025-06-07 22:34:44 +02:00
dependabot[bot]
d83d4613ce
build(deps): bump golang.org/x/crypto from 0.38.0 to 0.39.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.38.0 to 0.39.0.
- [Commits](https://github.com/golang/crypto/compare/v0.38.0...v0.39.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-06 12:22:43 +00:00
dependabot[bot]
e2f26e7c8c
build(deps): bump github.com/gofiber/schema from 1.4.0 to 1.5.0
Bumps [github.com/gofiber/schema](https://github.com/gofiber/schema) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/gofiber/schema/releases)
- [Commits](https://github.com/gofiber/schema/compare/v1.4.0...v1.5.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-05 12:52:12 +00:00
Juan Calderon-Perez
f9eec854fd
🐛 fix: Subdomains offset handling (#3495)
* Fix Subdomains offset handling

* Update docs, add extra unit-tests

* update logic and tests

* update logic

* fix lint

* Update docs and tests

* Update ctx.go

* update docs

* update docs

* update docs

* add test case for port

* Update offset documentation
2025-06-05 09:36:21 +02:00
RW
9409e4ff0c
📒 docs: Remove deprecated comments and documenting recent changes (#3498)
* removing deprecated comments and documenting the changes in the whats new overview

* removing deprecated comments and documenting the changes in the whats new overview
2025-06-04 08:20:00 +02:00
Juan Calderon-Perez
5eb1432c81
🐛 fix: Middlewares immutable config handling (#3494)
* Respect immutable flag in middlewares

* Add unit-tests for Immutable
2025-06-01 13:53:18 +02:00
Juan Calderon-Perez
0328b7baa7
Merge pull request #3492 from gofiber/dependabot/github_actions/kenchan0130/actions-system-info-1.3.1
build(deps): bump kenchan0130/actions-system-info from 1.3.0 to 1.3.1
2025-05-30 01:36:40 -04:00
Juan Calderon-Perez
09d9e169b2
🧹 chore: Enhance config validation in EncryptCookie middleware (#3491)
* test: validate encryptcookie config key

* simplified logic and remove duplicated code

* remove extra spaces
2025-05-28 15:12:57 +02:00
dependabot[bot]
788f702988
build(deps): bump kenchan0130/actions-system-info from 1.3.0 to 1.3.1
Bumps [kenchan0130/actions-system-info](https://github.com/kenchan0130/actions-system-info) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/kenchan0130/actions-system-info/releases)
- [Commits](https://github.com/kenchan0130/actions-system-info/compare/v1.3.0...v1.3.1)

---
updated-dependencies:
- dependency-name: kenchan0130/actions-system-info
  dependency-version: 1.3.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-28 12:29:51 +00:00
Juan Calderon-Perez
a779888d44
🧹 chore: Improve cache middleware RFC compliance (#3488)
* test: cover cache enhancements

* Fix lint issues and tests names

* Fix test

* Use utils.ToLower()

* Use utils.Trim

* Add missing param
2025-05-28 13:59:06 +02:00
Oleksandr Redko
956205311b
♻️ refactor: use maps.Copy to simplify code (#3490) 2025-05-28 12:49:33 +02:00
tongjicoder
557095b094
♻️ refactor: use slices.Contains to simplify code (#3486)
refactor: use slices.Contains to simplify code

Signed-off-by: tongjicoder <tongjicoder@icloud.com>
2025-05-27 20:03:22 +02:00
René
a590cdbcdd Skipped Benchmarks: too fast to compare reliably (results in sub-ns range are unstable)
Benchmark_GenericParseTypeInts
Benchmark_GenericParseTypeUints
Benchmark_GenericParseTypeFloats
2025-05-27 19:50:43 +02:00
Jason McNeil
7559758b02
🧪 test: Enhance CSRF tests to address unsafe header value issue (#2045) (#3485)
* 🧪 test: Enhance CSRF tests to address unsafe header value issue (#2045)

* Update middleware/csrf/csrf_test.go

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-27 19:18:25 +02:00
Juan Calderon-Perez
47f47ae2d8
🧹 chore: Enhance BasicAuth middleware to better comply with RFC 6750 (#3484)
* test(basicauth): ensure whitespace tolerant

* use utils.TrimSpace

* Update docs
2025-05-27 14:27:45 +02:00
Juan Calderon-Perez
804a2b923e
🧹 chore: Enhance KeyAuth middleware to better comply with RFC 6750 (#3482)
* docs(keyauth): add Realm option

* Add unit-test for GenericError case

* Update keyauth_test.go

* Backport fixes

* Update keyauth_test.go

* Fix spacing

* Add test for empty value

* Remove extra comma

* Add missing closing brace

* Review comments

* add missing import

* Add more unit-tests

* remove inconclusive test
2025-05-27 14:07:42 +02:00
Juan Calderon-Perez
23fb15f704
🔥 feat: Add support for NewErrorf (#3463)
* feat: support variadic messages in NewError

* Improve implementation and tests

* Update status code

* Update test

* Lint fixes

* More updates to test

* lint fixes

* add nolint

* Update app.go

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

* Update app.go

* Update app.go

* Use utils.ToString

* Add NewErrorf, revert changes

* Update docs

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-27 13:23:29 +02:00
RW
c2eee63183
🧹 chore: Update minimum go version to 1.24 (#3481)
* chore: update docs and workflows for go1.24

* Fix listen bug

* Use b.Loop() for benchmarks https://go.dev/blog/testing-b-loop

* Use b.Loop() for benchmarks https://go.dev/blog/testing-b-loop

* Revert b.Loop() for some benchmarks

* Change genericParser benchmarks (runParallel)

* Change Benchmark_Router_Github_API benchmarks (runParallel)
2025-05-27 13:23:02 +02:00
RW
da0aec0d64
Improve performance for "equalFieldType" function (#3479)
Improve performance for "equalFieldType" function

OLD:
```
Benchmark_equalFieldType-12    	 3320424	       361.0 ns/op	      80 B/op	       9 allocs/op
```

NEW:
```
Benchmark_equalFieldType-12    	11102847	       102.2 ns/op	      16 B/op	       3 allocs/op
```
+
solve the problem with passing on the tag name
2025-05-27 10:48:36 +02:00
RW
d756ec1b68
🧹 chore: Add URI Test case for Test_Ctx_Binders (#3480)
Add Uri Test case for Test_Ctx_Binders
2025-05-26 21:45:58 +02:00
René
0c6283fbff Fix docs issues 2025-05-26 09:34:50 +02:00
pj
9bd7a1c50d
feat: fiber.Context implement context.Context (#3382)
* Ctx implements context.Context

* fix up some linting issues

* added some tests

* no message

* fiber.Ctx implements context.Context

* no message

* implement compile-time check

* update formatting

* update compile-time checks

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-05-26 08:53:18 +02:00
Kashiwa
a5f76a7bee
♻️ refactor: Make genericParseType return error (#3473)
* ♻️ refact: make genericParseType return error

* 🐛 fix: return error when parsing unsupported type

* 🚨 test: cover the default value for Params

* 🚨 test: cover default value on parsing error

* ♻️ refact: change the benchmark name

* 🚨 test: remove the duplicated maxUint16 test case

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-05-25 23:54:03 +02: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
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