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:
commit
6fd725c953
@ -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
|
||||
|
||||
|
@ -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"))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user