363 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
dd739687d3
Refactor fasthttp iter calls to range loops (#3559)
refactor: replace fastHTTP iter calls with for loops
2025-07-01 14:14:56 +02:00
dependabot[bot]
eddecf22e4
build(deps): bump github.com/valyala/fasthttp from 1.62.0 to 1.63.0 (#3557)
* build(deps): bump github.com/valyala/fasthttp from 1.62.0 to 1.63.0

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

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

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

* Bump github.com/valyala/fasthttp from 1.62.0 to 1.63.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: René <rene@gofiber.io>
2025-07-01 11:06:50 +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
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
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
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
55818fb5bb
🧹 chore: Improve Accept* compliance with RFC 9110 (#3548)
* fix Accepts header compliance

* Simplify joinHeaderValues using bytes.Join

* Handle errors in unescapeHeaderValue

* test: cover header helpers

* Add paramsMatch escape error test
2025-06-28 21:29:19 +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
Juan Calderon-Perez
8e2ab968db
🧹 chore: Improve Cookie() validation (#3546)
* validate cookies with net/http

* refactor: sanitize cookie via net/http

* Address review comments

* refactor: set cookie attrs via setters

* Update ctx.go

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

* Update ctx.go

* Update ctx.go

* Update ctx.go

* Add more unit-tests

* Fix test

* Add default case for samesite

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-06-25 16:50:11 +02:00
Juan Calderon-Perez
a258661de3
🐛 bug: Fix Subdomains() parsing for IDNs (#3538)
* Use utils.ToLower in Subdomains

* test: cover Unicode fallback path

* fix subdomain extraction for rfc compliance

* Address review comments on Subdomains

* Address review comments
2025-06-23 14:59:34 +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
fcf5755c7c
🐛 bug: Fix Content-Type comparison in Is() (#3536)
* test: validate Is fails for JSON subtype

* Update ctx.go

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

* Update ctx.go

* Use immutable-aware getter for Content-Type

* Update ctx.go

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: RW <rene@gofiber.io>
2025-06-23 08:04:21 +02:00
Juan Calderon-Perez
b08d0bfd2f
🐛 bug: Fix Cache-Control header parsing (#3534)
* refactor: use utils.ToLower

* Improve Cache-Control directive matching

* Update middleware/cache/cache.go

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

* fix lint issue

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-23 07:42:12 +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
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
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
Kashiwa
e90fe8afbc
♻️Refactor: remove redundant field method in DefaultCtx (#3372)
* ♻️Refactor: remove redundant field method in defaultCtx

* ♻️Refactor: rename getMethodINT to getMethodInt
2025-03-26 13:16:53 +01:00
Kashiwa
4bf292945d
♻️Refactor: reduce DefaultCtx from 736 to 728 bytes (#3368) 2025-03-25 08:30:41 +01:00
Kashiwa
ef40c04ede
♻️ Refactor: reduce DefaultCtx from 768 bytes to 736 bytes (#3353)
* ♻️ Refactor: reduce DefaultCtx from 768 bytes to 736 bytes

* ♻️ Refactor: add comments

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-03-23 16:58:43 +01:00
Kashiwa
600ebd95ce
♻️ Refactor: replace isInCharset with bytes.IndexByte (#3342) 2025-03-07 15:33:22 +01:00
nickajacks1
64c1771c26
🔥 Feature: Add Req and Res API (#2894)
* 🔥 feat: add Req and Res interfaces

Split the existing Ctx API into two separate APIs for Requests and
Responses. There are two goals to this change:

1. Reduce cognitive load by making it more obvious whether a Ctx method
   interacts with the request or the response.
2. Increase API parity with Express.

* fix(req,res): several issues

* Sprinkle in calls to Req() and Res() to a few unit tests
* Fix improper initialization caught by ^
* Add a few missing methods

* docs: organize Ctx methods by request and response

* feat(req,res): sync more missed methods

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-03-05 08:01:43 +01:00
Juan Calderon-Perez
e7c1b3e5e2
Add new config option 2025-02-23 16:00:39 -05: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
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
ACHMAD IRIANTO EKA PUTRA
58677d5c86
feat: Add Drop method to DefaultCtx for silent connection termination (#3257)
* Add Drop method to DefaultCtx and remove redundant checks

Introduced a Drop method in DefaultCtx for closing connections, enabling easier resource management. Removed unnecessary nil-checks for headers in manager_msgp to simplify code logic. Added a unit test to ensure the new Drop method behaves as expected.

* Add `Drop` method to Fiber context API documentation

The `Drop` method allows silently terminating client connections without sending HTTP headers or a response body. This is useful for scenarios like mitigating DDoS attacks or blocking unauthorized access to sensitive endpoints. Example usage and function signature are included in the updated documentation.

* Remove extraneous blank line in documentation.

Eliminated an unnecessary blank line in the API context documentation for improved readability and formatting consistency. No functional changes were made to the content.

* Update API documentation example to return "Hello World!"

Revised the example code in the API documentation to return a generic "Hello World!" string instead of a dynamic response. This improves consistency and simplifies the example for easier understanding.

* Refactor Drop method and extend test coverage.

Simplified the Drop method by inlining the connection close call. Added new test cases to ensure proper handling of no-response scenarios and improved overall test coverage.

* fix golangci-lint issue

* Add test for Ctx.Drop with middleware interaction

This test ensures the correct behavior of the Ctx.Drop method when used with middleware, including response handling and error scenarios. It verifies that the middleware and handler properly handle the Drop call and its resulting effects.

* Add Drop method to DefaultCtx for closing connections

The Drop method allows closing connections without sending a response, improving control over connection handling. Also updated a test assertion to use StatusOK for improved readability and consistency.

* Refine Drop method comments to clarify error handling.

Explain the rationale for not wrapping errors in the Drop method. Emphasize that the returned error is solely for logging and not for further propagation or processing.

* Update Drop method documentation for clarity

Clarified the `Drop` method's behavior, specifying that it closes the connection without sending headers or a body. Added examples of use cases, such as DDoS mitigation and blocking sensitive endpoints.

* Refactor response header setting in middleware.

Replaced the direct header setting with the `Set` method for consistency and improved clarity. Removed a test case checking for a panic on closed response body as it is no longer applicable.
2024-12-23 08:20:41 +01:00
Sumit Kumar
26cc477500
🔥 feat: Add support for CBOR encoding (#3173)
* feat(cbor): allow encoding response bodies in cbor

* fix(tests::cbor): encode struct instead of a randomly ordered hashmap

* docs(whats_new): add cbor in context section

* feat(binder): introduce CBOR

* feat(client): allow cbor in fiber client

* chore(tests): add more test

* chore(packages): go mod tidy

* fix(binder): update CBOR name and test

* improve test coverage

* improve test coverage

* update1

* add docs

* doc fixes

* update

* Fix markdown lint

* Add missing entry from binder README

* add/refresh documentation

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: M. Efe Çetin <efectn@protonmail.com>
Co-authored-by: RW <rene@gofiber.io>
2024-12-01 11:03:50 +01:00
Giovanni Rivera
31a503f699
🔥 Feature (v3): Add buffered streaming support (#3131)
* 🔥 Feature: Add SendStreamWriter to Ctx

Create a new `*DefaultCtx` method called `SendStreamWriter()`
that maps to fasthttp's `Response.SetBodyStreamWriter()`

* 🚨 Test: Validate regular use of c.SendStreamWriter()

- Adds Test_Ctx_SendStreamWriter to ctx_test.go

* 🚨 Test: (WIP) Validate interrupted use of c.SendStreamWriter()

- Adds Test_Ctx_SendStreamWriter_Interrupted to ctx_test.go
    - (Work-In-Progress) This test verifies that some data is
      still sent before a client disconnects when using the method
      `c.SendStreamWriter()`.

**Note:** Running this test reports a race condition when using
the `-race` flag or running `make test`. The test uses a channel
and mutex to prevent race conditions, but still triggers a warning.

* 📚 Doc: Add `SendStreamWriter` to docs/api/ctx.md

* 🩹 Fix: Remove race condition in Test_Ctx_SendStreamWriter_Interrupted

* 🎨 Styles: Update ctx_test.go to respect golangci-lint

* 📚 Doc: Update /docs/api/ctx.md to show proper `w.Flush()` error handling

* 📚 Doc: Add SendStreamWriter details to docs/whats_new.md

* 🎨 Styles: Update /docs/whats_new.md to respect markdownlint-cli2

* 🩹 Fix: Fix Fprintf syntax error in docs/whats_new.md

---------

Co-authored-by: M. Efe Çetin <efectn@protonmail.com>
2024-11-27 11:11:56 +01:00
ItsMeSamey
f08ebf4335
🐛 fix: Nil pointer dereference with Must Bind binding (#3171)
* Fix nil pointer dereference with Must Bind binding error

if err is nil err.Error() panics
(eg. c.Bind().Must().JSON(...) successfully binds but panics

* Added returnErr test

make sure returnErr works with nil error

* Reordered returnErr nil check

as in majority of cases we expect err to be nil, this should provide better short-cutting

* Use require.NoError

* Update bind_test.go

* Renamed Must to WithAutoHandling

* Update bind.md

Added a requested clarification

* renamed Should to WithoutAutoHandling and Bind.should to Bind.dontHandle

* renamed dontHandle to dontHandleErrs

* fixed formatting

* fixed a typo

* Update binder documentation

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-11-25 11:51:36 +01:00
Juan Calderon-Perez
16f9056f5f
🐛 fix: Improve naming convention for Context returning functions (#3193)
* Rename UserContext() to Context(). Rename Context() to RequestCtx()

* Update Ctxt docs and What's new

* Remove extra blank lines

---------

Co-authored-by: M. Efe Çetin <efectn@protonmail.com>
2024-11-13 16:12:19 +01:00
Karen
2c7bdb9fd1
🩹 fix: Close File After SaveFileToStorage (#3197)
* fix: close file after opening in SaveFileToStorage to prevent resource leaks

* ♻️ refactor: simplify file close logic

* Update ctx.go

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-11-12 02:47:22 +01:00
xEricL
579d9a3f3d
📚 Doc: Clarify SendFile Docs (#3172)
* 📚 Doc: Clarify SendFile ContentType header set by file format

* 📚 Doc: Make SendFile default value formatting consistent

* 📚 Doc: Add missing `fiber.` in SendFile usage docs

* 📚 Doc: Hyphenate 'case-sensitive'

* 📚 Doc: Clarify `SendFile` behavior for missing/invalid file extensions

* 🚨 Test: Validate `SendFile` Content-Type header

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-10-28 08:11:24 +01:00
xEricL
298975a982
🔥Feature: Add support for TrustProxy (#3170)
* 🔥 Feature: Add `TrustProxyConfig` and rename `EnableTrustedProxyCheck` to `TrustProxy`

* 📚 Doc: Document TrustProxyConfig usage and migration

* 🚨 Test: Validate and Benchmark use of TrustProxyConfig

* 🩹 Fix: typo in RequestMethods docstring

* 🩹 Fix: typos in TrustProxy docstring and JSON tags

* 🩹 Fix: Move `TrustProxyConfig.Loopback` to beginning of if-statement

* 🎨 Style: Cleanup spacing for Test_Ctx_IsProxyTrusted

* 📚 Doc: Replace `whitelist` with `allowlist` for clarity

* 📚 Doc: Improve `TrustProxy` doc wording

* 🩹 Fix: validate IP addresses in `App.handleTrustedProxy`

* 🩹 Fix: grammatical errors and capitalize "TLS"
2024-10-17 08:29:03 +02:00
miyamo2
44cd700ad5
🩹 Fix: behavior of DefaultCtx.Fresh when 'Last-Modified' and 'If-Modified-Since' are equal (#3150)
* fix(ctx): 'if-modified-since' and 'last-modified' are equal, `DefaultCtx.Fresh` now returns true

* accurate benchmark measurements
2024-09-26 08:42:35 +02:00
Juan Calderon-Perez
f8c514cb25
v3: Optimize IsFromLocal() performance (#3140)
Optimize IsFromLocal()
2024-09-23 15:16:52 +02:00
M. Efe Çetin
08d9fda631
enhancement: use msgp for flash message encoding/decoding (#3099)
* enhancement: use msgp for flash message encoding/decoding

* add msgp tests

* improve test coverage

* improve test coverage

* fix linter

* update makefile

* extend go generation process

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: René <rene@gofiber.io>
2024-08-29 16:45:16 +02:00
Muhamad Surya Iksanudin
e43763311d
v3: Consolidate Logic of Handling the Request Body (#3093)
reduce redundant call
2024-07-27 07:42:54 +02:00
Juan Calderon-Perez
0592e01382
v3: Improve Performance of c.Body() by 125% (#3090)
* Improve performance of Body()

* Add unit-test and benchmark for BodyRaw() with Immutable
2024-07-25 08:58:40 +02:00
RW
fadedcb5be
Use utils Trim functions instead of the strings/bytes functions (#3087)
* Use utils Trim functions instead of the strings/bytes functions

* rename Test and Benchmark functions with same name
2024-07-24 16:25:35 +02:00
Juan Calderon-Perez
8c3f81e2b7
v3: Use Named Fields Instead of Positional and Align Structures to Reduce Memory Usage (#3079)
* 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
2024-07-23 08:37:45 +02:00
Juan Calderon-Perez
c579a1a0b3
v3: Improve and simplify logic of ctx.Next() (#3063)
* Simplify Next() handler in Ctx

* Add comments
2024-07-05 16:31:50 +02:00
M. Efe Çetin
4e5a501a47
🐛 bug: fasthttp errors cause panic when Params is used (#3055)
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-07-05 09:18:34 +02:00
M. Efe Çetin
56d60a084e
v3 (feature): add CHIPS support to Cookie (#3047)
*  v3 (feature): add CHIPS support to Cookie

* update docs

* Update docs/whats_new.md

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

* Update docs/api/ctx.md

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

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-06-30 21:38:46 +02:00
M. Efe Çetin
21ede5954c
v3 (feature): add configuration support to c.SendFile() (#3017)
*  v3 (feature): add configuration support to c.SendFile()

* update

* cover more edge-cases

* optimize

* update compression, add mutex for sendfile slice

* fix data races

* add benchmark

* update docs

* update docs

* update

* update tests

* fix linter

* update

* update tests

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-06-30 21:15:22 +02:00
Juan Calderon-Perez
b9936a339d
🔥 Feature: Add support for zstd compression (#3041)
* Add support for zstd compression

* Update whats_new.md

* Add benchmarks for Compress middleware

---------

Co-authored-by: RW <rene@gofiber.io>
2024-06-26 16:00:38 +02:00
Jason McNeil
011e83b390
docs: Improve ctx.Locals method description, godoc and example (#3032)
* docs: Improve ctx.Locals method description, godoc and example

* docs: Update ctx.md to use value receiver for fiber.Ctx in app.Use and app.Get

* chore: Update userKey type in ctx.md

* docs: Update ctx.md

* chore: Add description for Locals method in Ctx interface
2024-06-18 08:27:38 +02:00