15 Commits

Author SHA1 Message Date
Juan Calderon-Perez
10e92eb203
🐛 bug: Fix multipart boundary for Client per RFC 2046 (#3563)
🩹 Fix: remove leading dashes from multipart boundary
2025-07-03 18:30:47 +02:00
Kashiwa
01d8543bed
♻️ Refactor: improve iterator performance. (#3562)
* ♻️ Refactor: improve iterator performance.

```
goos: darwin
goarch: arm64
pkg: github.com/gofiber/fiber/v3/client
cpu: Apple M4
                        │   old.txt    │           new.txt           │
                        │    sec/op    │   sec/op     vs base        │
_Request_Headers-10       140.15n ± 0%   99.39n ± 1%  -29.08% (n=50)
_Request_Params-10        135.70n ± 0%   41.01n ± 0%  -69.78% (n=50)
_Request_AllFormData-10   135.60n ± 0%   94.67n ± 0%  -30.18% (n=50)
_Headers-10                291.3n ± 0%   156.8n ± 1%  -46.17% (n=50)
geomean                    165.6n        88.20n       -46.73%

                        │   old.txt   │              new.txt               │
                        │    B/op     │    B/op     vs base                │
_Request_Headers-10        200.0 ± 0%   184.0 ± 0%   -8.00% (n=50)
_Request_Params-10        232.00 ± 0%   88.00 ± 0%  -62.07% (n=50)
_Request_AllFormData-10    232.0 ± 0%   184.0 ± 0%  -20.69% (n=50)
_Headers-10                296.0 ± 0%   376.0 ± 0%  +27.03% (p=0.000 n=50)
geomean                    237.6        182.9       -23.00%

                        │  old.txt   │          new.txt           │
                        │ allocs/op  │ allocs/op   vs base        │
_Request_Headers-10       7.000 ± 0%   6.000 ± 0%  -14.29% (n=50)
_Request_Params-10        9.000 ± 0%   4.000 ± 0%  -55.56% (n=50)
_Request_AllFormData-10   9.000 ± 0%   6.000 ± 0%  -33.33% (n=50)
_Headers-10               9.000 ± 0%   6.000 ± 0%  -33.33% (n=50)
geomean                   8.452        5.422       -35.85%
```

* 🩹 Fix: fix wrong logic and revert Headers()
2025-07-02 20:35:03 +02: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
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
Oleksandr Redko
956205311b
♻️ refactor: use maps.Copy to simplify code (#3490) 2025-05-28 12:49:33 +02:00
M. Efe Çetin
87f3f0c8b6
🐛 bug: fix client iterators when using break statement (#3357)
* 🐛 bug: fix client iterators when using break statement

* fix linter
2025-03-19 11:00:16 +01:00
Kashiwa
69e5ccdd22
♻️ Refactor: Rename the Method Names of FormData and FormDatas (#3251) (#3255)
♻️ refactor: rename methods
2024-12-19 08:30:13 +01:00
Juan Calderon-Perez
c2b557c5ac
🧹 chore: Update documentation for Fiber client (#3249)
* Update client package inline documentation

* Update inline docs

* Update Client Request docs

* Fix formatting issues

* Update docs

* Update docs/client/response.md

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

* Add missing space

* Remove return statement

* Update request.go

* Update docs/client/response.md

* Update docs/client/hooks.md

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: RW <rene@gofiber.io>
2024-12-16 14:25:15 +01:00
Kashiwa
1134e1f408
🩹 fix: make SetValWithStruct set zero values and support more types #3167 (#3227)
* 🩹 fix: make SetValWithStruct set zero values and support more types

* 🚨 test: check zero in int_slice

* fix: SetValWithStruct does not exist in fiber v2

* 🩹fix: restrict supported types in SetValWithStruct

* 🩹fix: golangci-lint

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-12-13 11:14:11 +01:00
M. Efe Çetin
e9849b758d
🔥 feat: Add support for iterator methods to Fiber client (#3228)
* chore: simplify parserRequestBodyFile logic

* client: add support for go1.23 iterators

* Apply suggestions from code review

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

* fix linter

* fix tests

* correct benchmark

* fix linter

* create docs

* update

* rename FormDatas -> AllFormData

* add examples for maps.Collect()

* change request/response markdown examples

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: René <rene@gofiber.io>
2024-12-10 10:39:23 +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
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
M. Efe Çetin
3ba90c0fb0
docs: add docs for new client (#2991)
* docs: add docs for new client

* Add docs for client hooks

* Add docs for client examples

* Some fixes.

* docs: add docs for new client

* docs: add docs for new client

* Add more examples for methods

* Update docs/client/examples.md

Co-authored-by: Jason McNeil <sixcolors@mac.com>

* Add one more example for cookiejar

* apply review

* apply review

* apply review

* docs: add docs for new client

* docs: add docs for new client

---------

Co-authored-by: René <rene@gofiber.io>
Co-authored-by: Jason McNeil <sixcolors@mac.com>
2024-05-13 14:49:01 +02:00
Jinquan Wang
b38be4bcb3
v3 (feature): client refactor (#1986)
*  v3: Move the client module to the client folder and fix the error

*  v3: add xml encoder and decoder

* 🚧 v3: design plugin and hook mechanism, complete simple get request

* 🚧 v3: reset add some field

* 🚧 v3: add doc and fix some error

* 🚧 v3: add header merge

* 🚧 v3: add query param

* 🚧 v3: change to fasthttp's header and args

*  v3: add body and ua setting

* 🚧 v3: add cookie support

* 🚧 v3: add path param support

*  v3: fix error test case

* 🚧 v3: add formdata and file support

* 🚧 v3: referer support

* 🚧 v3: reponse unmarshal

*  v3: finish API design

* 🔥 v3: remove plugin mechanism

* 🚧 v3: add timeout

* 🚧 v3: change path params pattern and add unit test for core

* ✏️ v3: error spell

*  v3: improve test coverage

*  perf: change test func name to fit project format

* 🚧 v3: handle error

* 🚧 v3: add unit test and fix error

* ️ chore: change func to improve performance

*  v3: add some unit test

*  v3: fix error test

* 🐛 fix: add cookie to response

*  v3: add unit test

*  v3: export raw field

* 🐛 fix: fix data race

* 🔒️ chore: change package

* 🐛 fix: data race

* 🐛 fix: test fail

*  feat: move core to req

* 🐛 fix: connection reuse

* 🐛 fix: data race

* 🐛 fix: data race

* 🔀 fix: change to testify

*  fix: fail test in windows

*  feat: response body save to file

*  feat: support tls config

* 🐛 fix: add err check

* 🎨 perf: fix some static check

*  feat: add proxy support

*  feat: add retry feature

* 🐛 fix: static check error

* 🎨 refactor: move som code

* docs: change readme

*  feat: extend axios API

* perf: change field to export field

*  chore: disable startup message

* 🐛 fix: fix test error

* chore: fix error test

* chore: fix test case

* feat: add some test to client

* chore: add test case

* chore: add test case

*  feat: add peek for client

*  chore: add test case

* ️ feat: lazy generate rand string

* 🚧 perf: add config test case

* 🐛 fix: fix merge error

* 🐛 fix utils error

*  add redirection

* 🔥 chore: delete deps

* perf: fix spell error

* 🎨 perf: spell error

*  feat: add logger

*  feat: add cookie jar

*  feat: logger with level

* 🎨 perf: change the field name

* perf: add jar test

* fix proxy test

* improve test coverage

* fix proxy tests

* add cookiejar support from pending fasthttp PR

* fix some lint errors.

* add benchmark for SetValWithStruct

* optimize

* update

* fix proxy middleware

* use panicf instead of errorf and fix panic on default logger

* update

* update

* cleanup comments

* cleanup comments

* fix golang-lint errors

* Update helper_test.go

* add more test cases

* add hostclient pool

* make it more thread safe
-> there is still something which is shared between the requests

* fixed some golangci-lint errors

* fix Test_Request_FormData test

* create new test suite

* just create client for once

* use random port instead of 3000

* remove client pooling and fix test suite

* fix data races on logger tests

* fix proxy tests

* fix global tests

* remove unused code

* fix logger test

* fix proxy tests

* fix linter

* use lock instead of rlock

* fix cookiejar data-race

* fix(client): race conditions

* fix(client): race conditions

* apply some reviews

* change client property name

* apply review

* add parallel benchmark for simple request

* apply review

* apply review

* fix log tests

* fix linter

* fix(client): return error in SetProxyURL instead of panic

---------

Co-authored-by: Muhammed Efe Çetin <efectn@protonmail.com>
Co-authored-by: René Werner <rene.werner@verivox.com>
Co-authored-by: Joey <fenny@gofiber.io>
Co-authored-by: René <rene@gofiber.io>
2024-03-04 08:49:14 +01:00