388 Commits

Author SHA1 Message Date
Muhammed Efe Cetin
2514afd3ce
feat: add context methods to fiber.Storage interface 2025-07-07 14:34:29 +03:00
RW
e041d63ce9
🧹 chore: Add iterator helpers for client types (#3560)
* feat: add All iterators for client cookie and path params

* Remove deprecated VisitAll helpers
2025-07-02 13:39:25 +02:00
Juan Calderon-Perez
4597bc8f81
📒 docs: Add documentation for Stale() (#3555)
* Update docs for Stale()

* Apply suggestions from code review

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-07-01 09:09:30 +02:00
Juan Calderon-Perez
433d570202
📒 docs: Add net/http compatiblity section (#3556)
* General documentation updates

* Update README.md
2025-07-01 09:08:45 +02:00
Juan Calderon-Perez
fd188301e8
🐛 bug: Fix Body() handling of Content-Encoding per RFC 9110 (#3543)
* Adjust Body() decoding loop

* Handle identity and compress encodings

* Adjust Body status handling

* test: cover multi-encoding decode

* Address review feedback
2025-06-30 09:07:06 +02:00
Juan Calderon-Perez
d79fa01f0f
🐛 bug: Fix Content-Disposition header per RFC 6266 (#3551)
* Use raw UTF-8 filenames in Content-Disposition

* Fix lint issues

* Fix issue with new funct

* Improve and fix quoteRawString

* fix issues

* Fix lint issues

* fix golangci-lint

* Update static_test.go

* Update static_test.go
2025-06-30 09:06:11 +02:00
Laptop
cfa5b3a404
🔥 feat: Add UNIX socket support (#3535)
* set unix socket filemode and remove old unix socket before listening

* add UnixSocketFileMode to docs

* create NetworkUnix constant

* Add testing for listening on Unix network

* fix: always remove temporary directory in test

* try fix test on windows

* align ListenConfig struct

* document unix socket support in whats_new.md

* change default UnixSocketFileMode to 0770

* extend unix socket test

* reword about unix sockets support in whats_new.md

* Update docs/whats_new.md

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: RW <rene@gofiber.io>
2025-06-30 09:04:52 +02:00
Juan Calderon-Perez
bdd9e22bd7
🐛 bug: Fix Cache middleware handling of Age (#3547)
* Revert benchmark loop changes

* test: cover Age header parsing

* generate msgp files

* Update cache.go

* Cast result

* Update cache.go
2025-06-30 09:04:35 +02:00
Juan Calderon-Perez
55e7b1eb9c
🐛 bug: Fix Accept-Language matching per RFC 4647 (#3553)
* test: expand Accept-Language coverage

* Refine Accept-Language matching
2025-06-30 08:58:25 +02:00
Juan Calderon-Perez
fc803ec250
🐛 bug: Fix Range() handling of HTTP 416 per RFC 9110 (#3552)
* fix range compliance

* Update ctx.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update ctx.go

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-06-30 08:57:53 +02:00
Thai Nguyen Hung
9d683ba421
🐛 fix(docs): incorrect usage of backslash characters in the constraint … (#3549)
fix(docs): incorrect usage of backslash characters in the constraint examples
2025-06-30 08:55:25 +02:00
Juan Calderon-Perez
30bb809255
🐛 bug: Fix Etag validation per RFC 9110 (#3554)
* Add strong ETag comparison helper

* Review fixes

* update normalizeEtag

* cleanup new tests, add more cases.

* lint

* name param

* more fixes

* more fixes

* add missing param

* fix funct name

* string not bytes

* format is correct

* fix lint?

* enable debug output for linter

* Fix linter issue
2025-06-30 08:52:01 +02:00
Juan Calderon-Perez
43ad9f7928
🐛 bug: Fix Range() parsing of bytes unit (#3541)
refactor(ctx): use utils helpers for Range
2025-06-26 14:13:40 +02:00
RW
e58db87475
Add custom constraint example (#3539)
docs: add custom constraint example
2025-06-23 12:52:24 +02:00
RW
ad64f2cd8f
Add NewWithCustomCtx initialization helper (#3476)
* Make custom context setup via NewWithCustomCtx

* Update docs/api/app.md

* fix lint issues

* small optimizations

* Fix perf 3476 (#3499)

* perf: modify app.pool

goos: darwin
goarch: arm64
pkg: github.com/gofiber/fiber/v3
cpu: Apple M4
                       │   old.txt   │              new.txt               │
                       │   sec/op    │   sec/op     vs base               │
_Communication_Flow-10   36.26n ± 0%   34.51n ± 0%  -4.83% (p=0.000 n=30)

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

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

* perf: optimize defaultCtx in app.next

```
goos: darwin
goarch: arm64
pkg: github.com/gofiber/fiber/v3
cpu: Apple M4
                       │   new.txt   │              new4.txt               │
                       │   sec/op    │   sec/op     vs base                │
_Communication_Flow-10   34.51n ± 0%   30.02n ± 0%  -13.01% (p=0.000 n=30)

                       │  new.txt   │            new4.txt            │
                       │    B/op    │    B/op     vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal

                       │  new.txt   │            new4.txt            │
                       │ allocs/op  │ allocs/op   vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal
```

---------

Co-authored-by: Kashiwa <13825170+ksw2000@users.noreply.github.com>

* Improve performance #3476 (#3532)

* Make custom context setup via NewWithCustomCtx

* Update docs/api/app.md

* fix lint issues

* small optimizations

* perf: modify app.pool

goos: darwin
goarch: arm64
pkg: github.com/gofiber/fiber/v3
cpu: Apple M4
                       │   old.txt   │              new.txt               │
                       │   sec/op    │   sec/op     vs base               │
_Communication_Flow-10   36.26n ± 0%   34.51n ± 0%  -4.83% (p=0.000 n=30)

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

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

* perf: optimize defaultCtx in app.next

```
goos: darwin
goarch: arm64
pkg: github.com/gofiber/fiber/v3
cpu: Apple M4
                       │   new.txt   │              new4.txt               │
                       │   sec/op    │   sec/op     vs base                │
_Communication_Flow-10   34.51n ± 0%   30.02n ± 0%  -13.01% (p=0.000 n=30)

                       │  new.txt   │            new4.txt            │
                       │    B/op    │    B/op     vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal

                       │  new.txt   │            new4.txt            │
                       │ allocs/op  │ allocs/op   vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal
```

* perf: revert nextCustom

```
goos: darwin
goarch: arm64
pkg: github.com/gofiber/fiber/v3
cpu: Apple M4
                       │  head.txt   │            revert-1.txt            │
                       │   sec/op    │   sec/op     vs base               │
_Communication_Flow-10   30.04n ± 0%   28.74n ± 0%  -4.33% (p=0.000 n=30)

                       │  head.txt  │          revert-1.txt          │
                       │    B/op    │    B/op     vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal

                       │  head.txt  │          revert-1.txt          │
                       │ allocs/op  │ allocs/op   vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal
```

---------

Co-authored-by: RW <rene@gofiber.io>

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: Kashiwa <13825170+ksw2000@users.noreply.github.com>
2025-06-23 12:47:52 +02:00
Juan Calderon-Perez
6d16bf5605
🧹chore: Improve BasicAuth middleware default security (#3522)
* Refine BasicAuth middleware

* Fix lint issues

* Update basicauth.md
2025-06-20 08:47:35 +02:00
Jason McNeil
670fbd5e45
feat: Add support for Keys() in session middleware (#3517)
*  feat: Update session middleware add Keys method and update docs to match key type any

*  test: Add /keys endpoint to set and retrieve multiple session keys

*  test: Refactor /keys endpoint to trim whitespace and improve key handling in session tests
2025-06-13 11:40:17 +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
80f4f99c01
🧹 chore: Fix typos in code and docs (#3507)
chore: fix spelling mistakes across codebase
2025-06-07 22:34:44 +02: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
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
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
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
RW
aae8892c7e
Improve proxy middleware (#3468) 2025-05-23 10:47:05 +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
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
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
AuroraTea
2ef852e1a9
📚 Doc: Fix examples in middleware/session (#3435)
📚 Doc: Fix example in middleware/session
2025-05-06 08:33:12 +02: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é
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
Juan Calderon-Perez
d7e6413aa9
📒 docs: Update docs for State Management (#3388)
Update docs for State Management
2025-04-01 14:31:29 +02:00
JIeJaitt
c5c7f86d85
🔥 Feature: Enhance CheckConstraint method for improved error handling (#3356)
* 🔥 Feature: Enhance CheckConstraint method for improved error handling

* Revert "🔥 Feature: Enhance CheckConstraint method for improved error handling"

This reverts commit 68e8777b4cdb10702c3511a65ba76986a379a188.

* Reapply "🔥 Feature: Enhance CheckConstraint method for improved error handling"

This reverts commit 9e6c8e68df5ad43d869b6a7494e93b6fc41b4a40.

* 🚨 Test: Add comprehensive tests for CheckConstraint method with various constraint scenarios

* 🩹 Fix: lint error

* 🩹 Fix: Update CheckConstraint method to return true for noConstraint and improve error handling

* ♻️ Refactor: Remove unused CheckConstraint test cases and reorganize benchmark test cases for clarity

* ♻️ Refactor: Remove outdated test cases from path_testcases_test.go and clean up CheckConstraint method in path.go

* 📚 Doc: Update custom constraints section to clarify overriding behavior

* 🔥 Feature: Enhance CheckConstraint method for improved error handling

* Revert "🔥 Feature: Enhance CheckConstraint method for improved error handling"

This reverts commit 68e8777b4cdb10702c3511a65ba76986a379a188.

* Reapply "🔥 Feature: Enhance CheckConstraint method for improved error handling"

This reverts commit 9e6c8e68df5ad43d869b6a7494e93b6fc41b4a40.

* 🚨 Test: Add comprehensive tests for CheckConstraint method with various constraint scenarios

* 🩹 Fix: lint error

* 🩹 Fix: Update CheckConstraint method to return true for noConstraint and improve error handling

* ♻️ Refactor: Remove unused CheckConstraint test cases and reorganize benchmark test cases for clarity

* ♻️ Refactor: Remove outdated test cases from path_testcases_test.go and clean up CheckConstraint method in path.go

* 📚 Doc: Update custom constraints section to clarify overriding behavior

* 📚 Doc: Add caution note about custom constraints overriding built-in constraints in routing guide

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: RW <rene@gofiber.io>
2025-04-01 08:48:19 +02:00
M. Efe Çetin
d19e993597
feat: Add support for application state management (#3360)
*  feat: add support for application state management

* increase test coverage

* fix linter

* Fix typo

* add GetStateWithDefault helper

* add docs

* update what's new

* add has method

* fix linter

* update

* Add missing helpers for golang built-in types

* Fix lint issues

* Fix unit-tests. Update documentation

* Fix docs, add missing benchmarks

* Fix tests file

* Update default example and test

* Apply suggestions from code review

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: Juan Calderon-Perez <jgcalderonperez@protonmail.com>
Co-authored-by: RW <rene@gofiber.io>
2025-03-31 09:31:59 +02:00
Juan Calderon-Perez
75281bd874
🧹 chore: Simplify HealthCheck middleware (#3380)
* Simplify middleware

* Rename default endpoints
2025-03-30 11:46:52 +02:00
Mazyar Yousefiniyae shad
7606c618d3
📚 Doc: Add more validation examples (#3369)
* add examples on valudator guid

* ref: return prev validation comment
2025-03-25 08:25:56 +01:00
Edvard
e947e03ed2
🔥 feat(logger): Add predefined log formats (#3359)
* feat(logger): Add predefined log formats

This commit introduces predefined log formats for the logger middleware, enhancing its flexibility and ease of use. Users can now specify formats like "common", "combined", and "json" in addition to the default format.

Changes:

- Added a `format.go` file to store predefined log format constants.
- Updated `config.go` to include documentation for the `Format` configuration option, explaining the available placeholders and predefined formats.
- Modified `logger.go` to utilize the predefined formats based on the `Format` configuration.
- Added a new test case `Test_Logger_CLF` in `logger_test.go` to verify the "common" log format.

* feat(logger): Use predefined formats and fix default format

This commit updates the logger middleware to utilize the predefined log formats introduced in a previous commit. It also fixes the default format to use the `FormatDefault` constant.

Changes:

-   Updated `config.go` to use `FormatDefault` constant for the default format.
-   Updated `default_logger.go` to use `FormatDefault` constant for the default format.
-   Added new test cases in `logger_test.go` to verify the "common", "combined" and "json" log formats.
-   Updated `format.go` to add newline character to the end of the default format.

* feat(logger): Document and exemplify predefined formats

* fix(logger): Improve test assertions based on golangci-lint

* docs(logger): Improve documentation and formatting logger.md based on markdownlint-cli2

* docs(logger): Improve documentation based on markdownlint-cli2

* fix(logger): Improve combined and JSON format tests

* feat(logger): Add ECS log format

* feat(logger): Add CustomFormat option

This commit introduces a `CustomFormat` option to the `Config` struct, allowing users to specify a predefined format (like "common", "combined", "json", or "ecs")

* feat(logger): Add ECS log format to examples and config

* docs(logger): Update examples in whats_new.md

* feat(logger): Remove CustomFormat option and renamed Format consts

-   Removed `CustomFormat` field from `Config`.
-   Removed `LoggerConfig` map.
-   Rename predefined formats constants.

* docs(logger): Update documentation and examples after format refactor

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-03-21 16:13:21 +01:00
Juan Calderon-Perez
b56a141d59
docs: Update helmet.md default values (#3350)
Update helmet.md
2025-03-14 07:51:34 +01:00