mirror of
https://github.com/labstack/echo.git
synced 2024-12-22 20:06:21 +02:00
fixed docs
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
da91dffc11
commit
d51e679480
@ -12,8 +12,8 @@ description = "Context in Echo"
|
||||
|
||||
`echo.Context` represents the context of the current HTTP request. It holds request and
|
||||
response reference, path, path parameters, data, registered handler and APIs to read
|
||||
request and write response. Context is 100% compatible with standard `context.Context`.
|
||||
As Context is an interface, it is easy to extend it with custom APIs.
|
||||
request and write response. As Context is an interface, it is easy to extend it with
|
||||
custom APIs.
|
||||
|
||||
#### Extending Context
|
||||
|
||||
@ -56,20 +56,3 @@ e.Get("/", func(c echo.Context) error {
|
||||
return cc.String(200, "OK")
|
||||
})
|
||||
```
|
||||
|
||||
### Standard Context
|
||||
|
||||
`echo.Context` embeds standard `context.Context` interface, so all it's functions
|
||||
are available right from `echo.Context`.
|
||||
|
||||
*Example*
|
||||
|
||||
```go
|
||||
e.GET("/users/:name", func(c echo.Context) error) {
|
||||
c.SetContext(context.WithValue(nil, "key", "val"))
|
||||
// Pass it down...
|
||||
// Use it...
|
||||
val := c.Value("key").(string)
|
||||
return c.String(http.StatusOK, name)
|
||||
})
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user