From abc669bd07f509688451b915353feb47f47faef3 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Mon, 14 Mar 2016 08:09:48 -0700 Subject: [PATCH] Fixed #399 Signed-off-by: Vishal Rana --- context.go | 36 +++++++++++++++++++++--------------- glide.lock | 2 +- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/context.go b/context.go index 61b1f975..358844cb 100644 --- a/context.go +++ b/context.go @@ -26,6 +26,7 @@ type ( // response objects, path parameters, data and registered handler. Context interface { netContext.Context + SetNetContext(netContext.Context) Request() engine.Request Response() engine.Response Path() string @@ -57,15 +58,16 @@ type ( } context struct { - request engine.Request - response engine.Response - path string - pnames []string - pvalues []string - query url.Values - store store - handler Handler - echo *Echo + netContext netContext.Context + request engine.Request + response engine.Response + path string + pnames []string + pvalues []string + query url.Values + store store + handler Handler + echo *Echo } 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 { - return c.handler.Handle(ctx) +func (c *context) SetNetContext(ctx netContext.Context) { + c.netContext = ctx } func (c *context) Deadline() (deadline time.Time, ok bool) { - return + return c.netContext.Deadline() } func (c *context) Done() <-chan struct{} { - return nil + return c.netContext.Done() } func (c *context) Err() error { - return nil + return c.netContext.Err() } 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. diff --git a/glide.lock b/glide.lock index 4c3be7aa..7c84b945 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ hash: f220137e9ccd9aaf3051be33c3c23ea8abd2c40df6cf96175c3994d482b5e007 -updated: 2016-03-13T09:34:16.391046379-07:00 +updated: 2016-03-14T08:16:01.763706114-07:00 imports: - name: github.com/klauspost/compress version: 006acde2c5d283d2f8b8aa03d8f0cd2891c680cf