-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📚 Doc: Add TestConfig option details to docs/whats_new.md
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,6 +220,33 @@ the signature of the `Test` method. | |
+ Test(req *http.Request, config ...fiber.TestConfig) (*http.Response, error) | ||
``` | ||
|
||
The `TestConfig` struct provides the following configuration options: | ||
- `Timeout`: | ||
Check failure on line 224 in docs/whats_new.md
|
||
- The duration to wait before timing out the test. Use 0 for no timeout. | ||
- `FailOnTimeout`: | ||
- When true, the test will return an `os.ErrDeadlineExceeded` if the test exceeds the `Timeout` duration. | ||
- When false, the test will return the partial response received before timing out. | ||
|
||
If a custom `TestConfig` isn't provided, then the following will be used: | ||
|
||
```go | ||
testConfig := fiber.TestConfig{ | ||
Timeout: time.Second, | ||
FailOnTimeout: true, | ||
} | ||
``` | ||
|
||
**Note:** Using this default is **NOT** the same as providing an empty `TestConfig` as an argument to `app.Test()`. | ||
|
||
An empty `TestConfig` is the equivalent of: | ||
|
||
```go | ||
testConfig := fiber.TestConfig{ | ||
Timeout: 0, | ||
FailOnTimeout: false, | ||
} | ||
``` | ||
|
||
--- | ||
|
||
## 🧠 Context | ||
|