-
-
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.
- Loading branch information
Showing
2 changed files
with
27 additions
and
24 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 |
---|---|---|
|
@@ -354,15 +354,20 @@ app.Get("/hello", func(c fiber.Ctx) error { | |
|
||
## Context | ||
|
||
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. | ||
Context returns a context implementation that was set by user earlier or returns a non-nil, empty context, if it was not set earlier. | ||
|
||
```go title="Signature" | ||
func (c Ctx) Context() *fasthttp.RequestCtx | ||
func (c Ctx) Context() context.Context | ||
``` | ||
|
||
:::info | ||
Please read the [Fasthttp Documentation](https://pkg.go.dev/github.com/valyala/fasthttp?tab=doc) for more information. | ||
::: | ||
```go title="Example" | ||
app.Get("/", func(c fiber.Ctx) error { | ||
ctx := c.Context() | ||
// ctx is context implementation set by user | ||
|
||
// ... | ||
}) | ||
``` | ||
|
||
## Cookie | ||
|
||
|
@@ -1489,6 +1494,19 @@ app.Get("/", func(c fiber.Ctx) error { | |
}) | ||
``` | ||
## RequestCtx | ||
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. | ||
```go title="Signature" | ||
func (c Ctx) RequestCtx() *fasthttp.RequestCtx | ||
``` | ||
:::info | ||
Please read the [Fasthttp Documentation](https://pkg.go.dev/github.com/valyala/fasthttp?tab=doc) for more information. | ||
::: | ||
Check failure on line 1509 in docs/api/ctx.md GitHub Actions / markdownlintMultiple consecutive blank lines
|
||
## Response | ||
Response return the [\*fasthttp.Response](https://godoc.org/github.com/valyala/fasthttp#Response) pointer | ||
|
@@ -1893,7 +1911,7 @@ app.Get("/", func(c fiber.Ctx) error { | |
|
||
## SetContext | ||
|
||
Sets the user specified implementation for context interface. | ||
Sets the user specified implementation for context.Context interface. | ||
|
||
```go title="Signature" | ||
func (c Ctx) SetContext(ctx context.Context) | ||
|
@@ -2005,24 +2023,6 @@ app.Get("/", func(c fiber.Ctx) error { | |
}) | ||
``` | ||
|
||
## Context | ||
|
||
Context returns a context implementation that was set by user earlier | ||
or returns a non-nil, empty context, if it was not set earlier. | ||
|
||
```go title="Signature" | ||
func (c Ctx) Context() context.Context | ||
``` | ||
|
||
```go title="Example" | ||
app.Get("/", func(c fiber.Ctx) error { | ||
ctx := c.Context() | ||
// ctx is context implementation set by user | ||
// ... | ||
}) | ||
``` | ||
|
||
## Vary | ||
|
||
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. | ||
|
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