1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-26 03:20:08 +02:00

Fix Context#SetContext()/Context#Context()

This commit is contained in:
Kazuhiro Kubota 2016-08-22 20:41:07 +09:00
parent 98061d3ce3
commit 48c42e7b90
2 changed files with 8 additions and 1 deletions

View File

@ -25,6 +25,12 @@ type (
Context interface {
context.Context
// Context returns `net/context.Context`.
Context() context.Context
// SetContext sets `net/context.Context`.
SetContext(context.Context)
// Request returns `engine.Request` interface.
Request() engine.Request

View File

@ -328,7 +328,8 @@ func TestContextRedirect(t *testing.T) {
}
func TestContextEmbedded(t *testing.T) {
c := new(echoContext)
var c Context
c = new(echoContext)
c.SetContext(context.WithValue(c, "key", "val"))
assert.Equal(t, "val", c.Value("key"))
now := time.Now()