Skip to content

Commit

Permalink
📚 Doc: Add TestConfig option details to docs/whats_new.md
Browse files Browse the repository at this point in the history
  • Loading branch information
grivera64 committed Nov 19, 2024
1 parent 334dbe8 commit b389aaa
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/whats_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

View workflow job for this annotation

GitHub Actions / markdownlint

Lists should be surrounded by blank lines

docs/whats_new.md:224 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- `Timeout`:"] https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md032.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
Expand Down

0 comments on commit b389aaa

Please sign in to comment.