mirror of
https://github.com/labstack/echo.git
synced 2025-06-04 23:37:45 +02:00
parent
b9ac79d9d4
commit
abc669bd07
36
context.go
36
context.go
@ -26,6 +26,7 @@ type (
|
|||||||
// response objects, path parameters, data and registered handler.
|
// response objects, path parameters, data and registered handler.
|
||||||
Context interface {
|
Context interface {
|
||||||
netContext.Context
|
netContext.Context
|
||||||
|
SetNetContext(netContext.Context)
|
||||||
Request() engine.Request
|
Request() engine.Request
|
||||||
Response() engine.Response
|
Response() engine.Response
|
||||||
Path() string
|
Path() string
|
||||||
@ -57,15 +58,16 @@ type (
|
|||||||
}
|
}
|
||||||
|
|
||||||
context struct {
|
context struct {
|
||||||
request engine.Request
|
netContext netContext.Context
|
||||||
response engine.Response
|
request engine.Request
|
||||||
path string
|
response engine.Response
|
||||||
pnames []string
|
path string
|
||||||
pvalues []string
|
pnames []string
|
||||||
query url.Values
|
pvalues []string
|
||||||
store store
|
query url.Values
|
||||||
handler Handler
|
store store
|
||||||
echo *Echo
|
handler Handler
|
||||||
|
echo *Echo
|
||||||
}
|
}
|
||||||
|
|
||||||
store map[string]interface{}
|
store map[string]interface{}
|
||||||
@ -87,24 +89,28 @@ func NewContext(req engine.Request, res engine.Response, e *Echo) Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *context) Handle(ctx Context) error {
|
func (c *context) SetNetContext(ctx netContext.Context) {
|
||||||
return c.handler.Handle(ctx)
|
c.netContext = ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *context) Deadline() (deadline time.Time, ok bool) {
|
func (c *context) Deadline() (deadline time.Time, ok bool) {
|
||||||
return
|
return c.netContext.Deadline()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *context) Done() <-chan struct{} {
|
func (c *context) Done() <-chan struct{} {
|
||||||
return nil
|
return c.netContext.Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *context) Err() error {
|
func (c *context) Err() error {
|
||||||
return nil
|
return c.netContext.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *context) Value(key interface{}) interface{} {
|
func (c *context) Value(key interface{}) interface{} {
|
||||||
return nil
|
return c.netContext.Value(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *context) Handle(ctx Context) error {
|
||||||
|
return c.handler.Handle(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request returns *http.Request.
|
// Request returns *http.Request.
|
||||||
|
2
glide.lock
generated
2
glide.lock
generated
@ -1,5 +1,5 @@
|
|||||||
hash: f220137e9ccd9aaf3051be33c3c23ea8abd2c40df6cf96175c3994d482b5e007
|
hash: f220137e9ccd9aaf3051be33c3c23ea8abd2c40df6cf96175c3994d482b5e007
|
||||||
updated: 2016-03-13T09:34:16.391046379-07:00
|
updated: 2016-03-14T08:16:01.763706114-07:00
|
||||||
imports:
|
imports:
|
||||||
- name: github.com/klauspost/compress
|
- name: github.com/klauspost/compress
|
||||||
version: 006acde2c5d283d2f8b8aa03d8f0cd2891c680cf
|
version: 006acde2c5d283d2f8b8aa03d8f0cd2891c680cf
|
||||||
|
Loading…
x
Reference in New Issue
Block a user