You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns [\*fasthttp.RequestCtx](https://godoc.org/github.com/valyala/fasthttp#RequestCtx) that is compatible with the context.Context interface that requires a deadline, a cancellation signal, and other values across API boundaries.
357
+
Context returns a context implementation that was set by user earlier or returns a non-nil, empty context, if it was not set earlier.
358
358
359
359
```go title="Signature"
360
-
func(cCtx) Context() *fasthttp.RequestCtx
360
+
func(cCtx) Context() context.Context
361
361
```
362
362
363
-
:::info
364
-
Please read the [Fasthttp Documentation](https://pkg.go.dev/github.com/valyala/fasthttp?tab=doc) for more information.
Returns [\*fasthttp.RequestCtx](https://godoc.org/github.com/valyala/fasthttp#RequestCtx) that is compatible with the context.Context interface that requires a deadline, a cancellation signal, and other values across API boundaries.
1500
+
1501
+
```go title="Signature"
1502
+
func (c Ctx) RequestCtx() *fasthttp.RequestCtx
1503
+
```
1504
+
1505
+
:::info
1506
+
Please read the [Fasthttp Documentation](https://pkg.go.dev/github.com/valyala/fasthttp?tab=doc) for more information.
1507
+
:::
1508
+
1492
1509
## Response
1493
1510
1494
1511
Response return the [\*fasthttp.Response](https://godoc.org/github.com/valyala/fasthttp#Response) pointer
UserContext returns a context implementation that was set by user earlier
2011
-
or returns a non-nil, empty context, if it was not set earlier.
2012
-
2013
-
```go title="Signature"
2014
-
func (c Ctx) UserContext() context.Context
2015
-
```
2016
-
2017
-
```go title="Example"
2018
-
app.Get("/", func(c fiber.Ctx) error {
2019
-
ctx := c.UserContext()
2020
-
// ctx is context implementation set by user
2021
-
2022
-
// ...
2023
-
})
2024
-
```
2025
-
2026
2025
## Vary
2027
2026
2028
2027
Adds the given header field to the [Vary](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary) response header. This will append the header, if not already listed, otherwise leaves it listed in the current location.
Copy file name to clipboardExpand all lines: docs/core/middleware/timeout.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ There exist two distinct implementations of timeout middleware [Fiber](https://g
8
8
9
9
## New
10
10
11
-
As a `fiber.Handler` wrapper, it creates a context with `context.WithTimeout`and pass it in `UserContext`.
11
+
As a `fiber.Handler` wrapper, it creates a context with `context.WithTimeout`which is then used with `c.Context()`.
12
12
13
13
If the context passed executions (eg. DB ops, Http calls) takes longer than the given duration to return, the timeout error is set and forwarded to the centralized `ErrorHandler`.
0 commit comments