1
0
mirror of https://github.com/labstack/echo.git synced 2025-06-10 23:57:28 +02:00
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-03-14 08:09:48 -07:00
parent b9ac79d9d4
commit abc669bd07
2 changed files with 22 additions and 16 deletions

View File

@ -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,6 +58,7 @@ type (
} }
context struct { context struct {
netContext netContext.Context
request engine.Request request engine.Request
response engine.Response response engine.Response
path string path string
@ -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
View File

@ -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