1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-07 23:01:56 +02:00

fixed docs

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-11-14 23:58:57 -08:00
parent da91dffc11
commit d51e679480

View File

@ -12,8 +12,8 @@ description = "Context in Echo"
`echo.Context` represents the context of the current HTTP request. It holds request and `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 response reference, path, path parameters, data, registered handler and APIs to read
request and write response. Context is 100% compatible with standard `context.Context`. request and write response. As Context is an interface, it is easy to extend it with
As Context is an interface, it is easy to extend it with custom APIs. custom APIs.
#### Extending Context #### Extending Context
@ -56,20 +56,3 @@ e.Get("/", func(c echo.Context) error {
return cc.String(200, "OK") 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)
})
```