fiber/client
Juan Calderon-Perez 0379cc59aa
fix: Inconsistent and flaky unit-tests (#2892)
* Fixes for some of the failing tests

* Add readiness check to serverStart()

* Use net/http client for tests listen test

* Use different key for this test

* Run Proxy Middleware tests in parallel. Add nil checks for potential issues pointed by nilaway

* Enable parallel client tests

* Do not run timing sensitive tests in parallel

* Remove TODO

* Revert Test_Proxy_DoTimeout_Timeout, and remove t.Parallel() for it

* Do not calculate favicon len on each handler call

* Revert logic change

* Increase timeout of SaveFile tests

* Do not run time sensitive tests in parallel

* The Agent can't be run in parallel

* Do not run time sensitive tests in parallel

* Fixes based on uber/nilaway

* Revert change to Client test

* Run parallel

* Update client_test.go

* Update client_test.go

* Update cache_test.go

* Update cookiejar_test.go

* Remove parallel for test using timeouts

* Remove t.Parallel() from logger middleware tests

* Do not use testify.require in a goroutine

* Fix import, and update golangci-lint

* Remove changes to template_chain.go

* Run more tests in parallel

* Add more parallel tests

* Add more parallel tests

* SetLogger can't run in parallel

* Run more tests in parallel, fix issue with goroutine in limiter middleware

* Update internal/storage/memory, add more benchmarks

* Increase sleep for csrf test by 100 milliseconds. Implement asserted and parallel benchmarks for Session middleware

* Add 100 milliseconds to sleep during test

* Revert name change

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

---------

Co-authored-by: M. Efe Çetin <efectn@protonmail.com>
Co-authored-by: René <rene@gofiber.io>
2024-03-08 20:03:13 +01:00
..
README.md v3 (feature): client refactor (#1986) 2024-03-04 08:49:14 +01:00
client.go refactor: Rename "ClientNew" Function to "New" (#2896) 2024-03-07 16:23:29 +01:00
client_test.go fix: Inconsistent and flaky unit-tests (#2892) 2024-03-08 20:03:13 +01:00
cookiejar.go v3 (feature): client refactor (#1986) 2024-03-04 08:49:14 +01:00
cookiejar_test.go fix: Inconsistent and flaky unit-tests (#2892) 2024-03-08 20:03:13 +01:00
core.go v3 (feature): client refactor (#1986) 2024-03-04 08:49:14 +01:00
core_test.go fix: Inconsistent and flaky unit-tests (#2892) 2024-03-08 20:03:13 +01:00
helper_test.go fix: Inconsistent and flaky unit-tests (#2892) 2024-03-08 20:03:13 +01:00
hooks.go v3 (feature): client refactor (#1986) 2024-03-04 08:49:14 +01:00
hooks_test.go fix: Inconsistent and flaky unit-tests (#2892) 2024-03-08 20:03:13 +01:00
request.go v3 (feature): client refactor (#1986) 2024-03-04 08:49:14 +01:00
request_test.go fix: Inconsistent and flaky unit-tests (#2892) 2024-03-08 20:03:13 +01:00
response.go v3 (feature): client refactor (#1986) 2024-03-04 08:49:14 +01:00
response_test.go fix: Inconsistent and flaky unit-tests (#2892) 2024-03-08 20:03:13 +01:00

README.md

Fiber Client

Easy-to-use HTTP client based on fasthttp (inspired by resty and axios)

Features section describes in detail about Resty capabilities

Features

The characteristics have not yet been written.

  • GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS, etc.
  • Simple and chainable methods for settings and request
  • Request Body can be string, []byte, map, slice
    • Auto detects Content-Type
    • Buffer processing for files
    • Native *fasthttp.Request instance can be accessed during middleware and request execution via Request.RawRequest
    • Request Body can be read multiple time via Request.RawRequest.GetBody()
  • Response object gives you more possibility
    • Access as []byte by response.Body() or access as string by response.String()
  • Automatic marshal and unmarshal for JSON and XML content type
    • Default is JSON, if you supply struct/map without header Content-Type
    • For auto-unmarshal, refer to -
      • Success scenario Request.SetResult() and Response.Result().
      • Error scenario Request.SetError() and Response.Error().
      • Supports RFC7807 - application/problem+json & application/problem+xml
    • Provide an option to override JSON Marshal/Unmarshal and XML Marshal/Unmarshal

Usage

The following samples will assist you to become as comfortable as possible with Fiber Client library.

// Import Fiber Client into your code and refer it as `client`.
import "github.com/gofiber/fiber/client"

Simple GET