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

Merge branch 'k2wanko-fix-set-context't push origin master

This commit is contained in:
Vishal Rana 2016-08-22 08:31:21 -07:00
commit 6fd725c953
2 changed files with 10 additions and 2 deletions

View File

@ -25,6 +25,12 @@ type (
Context interface {
context.Context
// Context returns `context.Context`.
Context() context.Context
// SetContext sets `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()
@ -341,7 +342,8 @@ func TestContextEmbedded(t *testing.T) {
}
func TestContextStore(t *testing.T) {
c := new(echoContext)
var c Context
c = new(echoContext)
c.Set("name", "Jon Snow")
assert.Equal(t, "Jon Snow", c.Get("name"))
}