* Use composites for internal structures. Fix alignment of structures across Fiber
* Update struct alignment in test files
* Enable alignment check with govet
* Fix ctx autoformat unit-test
* Revert app Config struct. Add betteralign to Makefile
* Disable comment on alert since it wont work for forks
* Update benchmark.yml
* Update benchmark.yml
* Remove warning from using positional fields
* Update router.go
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* [v3 Maintenance]: Consolidate and Document Core Changes in v3
* Add support for Access-Control-Allow-Private-Network in CORS middleware
* Access-Control-Allow-Private-Network in CORS middleware documentation update
* Access-Control-Allow-Private-Network in CORS middleware tests
* Fix lint issues
* Fix formatting
* Rename config option, add more unit-tests
* Fix syntax issue
* Fix conditional
* Fix formatting, add more unit-tests
* chore(middleware/cors): Update middleware/cors/cors.go
* chore(middleware/cors): add HeaderAccessControlRequestPrivateNetowkr
* test(middleware/cors): fix CORS headers
* docs(middleware/cors): table order and alignment
---------
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: Juan Calderon-Perez <jgcalderonperez@protonmail.com>
Co-authored-by: Jason McNeil <sixcolors@mac.com>
* refactor: Update to use fasthttp.VisitHeaderParams
The implementation of forEachParameter was upstreamed to fasthttp, so
use that version instead of maintaining our own.
* refactor: use map for header params
The previous implementation of content negotiation used some difficult
to understand techniques in order to reduce allocations, potentially
hurting maintainability. The more natural approach for storing and
comparing unordered media-type parameters is to utilize maps. While the
resulting code still isn't as simple as it could be, it's a step closer.
To reduce allocations, we use a sync.Pool. This actually reduces in fewer
allocations than before at 3 or more parameters. The net result is nearly
identical performance for zero parameters, almost-as-good performance for
1-2 parameters, and better performance for 3+ parameters.
---------
Co-authored-by: Jason McNeil <sixcolors@mac.com>
* ci: explicitly disable tagalign
Tagalign requires awkward manual formatting and doesn't provide much
value for readability.
* ci: enable mirror linter
mirror warns against certain cases of useless conversion between string
and []byte.
* ci: enable perfsprint linter
This linter encourages replacing several functions from the fmt package
with faster alternatives. While fixing issues, I also added a few
exported error types rather than returning a naked errors.New().
* Update linter.yml
* Disable spancheck, fix some of the errors
* Fix ErrorAs, disable go-require from testifylint
* Remove extra space
* Fix all warnings from golangci-lint and revive unused params
* Refactor CopyContextToFiberContext
* Update adaptor.go
* ✨ feat: add support for parameters in content negotiation
Attempts to approach the level of support offered by express,
but behavior may differ in unusual corner cases.
Some key behaviors from Express that are implemented:
- If an offer does not have every parameter listed in the given Accept,
it is rejected.
- Parameters do not affect specificity.
- In a given specificity, more parameters gives greater precedence
- Parameters are unordered
- Matching is case-insensitive
- Surrounding quotes for parameter values are stripped
- If an Accept type specifies a parameter more than once, the last
value provided is taken.
- Parameters after q are not processed.
https://www.rfc-editor.org/rfc/rfc9110#name-parameters
* doc: properly attribute reader.go for validHeaderFieldByte
* fix: remove underscores from fuzz test name
* test(forEachParameter): improve coverage
* doc: add comment clarifying RFC 9110 non-compliance for corner case
* 🔧 feat: Decode body in order when sent a list on content-encoding
* 🚀 perf: Change `getSplicedStrList` to have 0 allocations
* 🍵 test: Add tests for the new features
* 🍵 test: Ensure session test will not raise an error unexpectedly
* 🐗 feat: Replace strings.TrimLeft by utils.TrimLeft
Add docs to functions to inform correctly what the change is
* 🌷 refactor: Apply linter rules
* 🍵 test: Add test cases to the new body method change
* 🔧 feat: Remove return problems to be able to reach original body
* 🌷 refactor: Split Body method into two to make it more maintainable
Also, with the previous fix to problems detected by tests, it becomes really hard to make the linter happy, so this change also helps in it
* 🚀 perf: Came back with Header.VisitAll, to improve speed
* 📃 docs: Update Context docs
* internal: revert linting changes
Changes to the internal package should not have been made in 167a8b5e94.
* middleware/monitor: revert changes to exported field "ChartJSURL"
This is a breaking change introduced in 167a8b5e94.
* middleware/monitor: fix error checking
Fix the errorenous error checking introduced in 167a8b5e94.
* 🐛 Bug: Fix issues introduced in linting PR #2319
* 🐛 Bug: Fix issues introduced in linting PR #2319
* Bug: Fix issues introduced in linting PR #2319
---------
Co-authored-by: René Werner <rene@gofiber.io>
* golangci-lint: add and apply more stricter linting rules
* github: drop security workflow now that we use gosec linter inside golangci-lint
* github: use official golangci-lint CI linter
* Add editorconfig and gitattributes file
* 🚀 Feature: Add idempotency middleware (#2253)
* middleware: add idempotency middleware
* middleware/idempotency: use fiber.Storage instead of custom storage
* middleware/idempotency: only allocate data if really required
* middleware/idempotency: marshal response using msgp
* middleware/idempotency: add msgp tests
* middleware/idempotency: do not export response
* middleware/idempotency: disable msgp's -io option to disable generating unused methods
* middleware/idempotency: switch to time.Duration based app.Test
* middleware/idempotency: only create closure once
* middleware/idempotency: add benchmarks
* middleware/idempotency: optimize strings.ToLower when making comparison
The real "strings.ToLower" still needs to be used when storing the data.
* middleware/idempotency: safe-copy body
* middleware/idempotency: backport to v2
* middleware: add idempotency middleware
* middleware/idempotency: use fiber.Storage instead of custom storage
* middleware/idempotency: only allocate data if really required
* middleware/idempotency: marshal response using msgp
* middleware/idempotency: add msgp tests
* middleware/idempotency: do not export response
* middleware/idempotency: disable msgp's -io option to disable generating unused methods
* middleware/idempotency: switch to time.Duration based app.Test
* middleware/idempotency: only create closure once
* middleware/idempotency: add benchmarks
* middleware/idempotency: optimize strings.ToLower when making comparison
The real "strings.ToLower" still needs to be used when storing the data.
* middleware/idempotency: safe-copy body
* - logger: fix custom tag
- use real bytebufferpool dependency instead of the internal
* - logger: fix custom tag
- use real bytebufferpool dependency instead of the internal
* - logger: fix custom tag
- use real bytebufferpool dependency instead of the internal
* - logger: fix custom tag
- use real bytebufferpool dependency instead of the internal
* WIP: Use Parent Error Handler on Mount
* Add suggested boolean guard
* Move flag to App
* Move to copy of config as configured
* Apply the same trick to customMethod
* helpers: add HTTP status code 306
* helpers: show numeric HTTP status code instead of status code RFC next to errors
* utils: add HTTP status code 425
* helpers,utils: update list of HTTP status codes
* ✨ v3: use any as default Message type of Error struct.
* ✨ v3: use any as default Message type of Error struct.
* ✨ v3: use any as default Message type of Error struct.
* ✨ v3: use any as default Message type of Error struct.