func (ctx *Context) WithContext(c context.Context) {
	if c.Value(isGearContext) != nil {
		panic(Err.WithMsg("should not use *gear.Context as parent context, please use ctx.Context()"))
	}
	if c.Value(isInheritedContext) == nil {
		panic(Err.WithMsg("the context is not created from ctx.Context()"))
	}
	ctx.Req = ctx.Req.WithContext(c)
	ctx.ctx = c
}
WithContext sets the context to underlying gear.Context.
The context must be a children or a grandchild of gear.Context.

ctx.WithContext(ctx.WithValue("key", "value"))
// ctx.Value("key") == "value"
package gear
import (
	"bytes"
	"context"
	"encoding/json"
	"encoding/xml"
	"fmt"
	"io"
	"io/ioutil"
	"mime"
	"net"
	"net/http"
	"net/url"
	"strings"
	"time"
	"github.com/go-http-utils/cookie"
	"github.com/go-http-utils/negotiator"
)
type contextKey int
const (
	isInheritedContext contextKey = iota
	isGearContext
	paramsKey
	routerNodeKey
	routerRootKey
)
type Any interface {
	New(ctx *Context) (interface{}, error)
}
type BodyTemplate interface {
	Validate() error
}
type Context struct {
	app     *App
	Req     *http.Request
	Res     *Response
	Cookies *cookie.Cookies  
	Host    string
	Method  string
	Path    string
	StartAt time.Time
	query     url.Values
	ctx       context.Context
	cancelCtx context.CancelFunc
	done      <-chan struct{}
	kv        map[interface{}]interface{}
}
func NewContext(app *App, w http.ResponseWriter, r *http.Request) *Context {
	ctx := Context{
		app: app,
		Res: &Response{w: w, rw: w, handlerHeader: w.Header()},
		Host:    r.Host,
		Method:  r.Method,
		Path:    r.URL.Path,
		StartAt: time.Now().UTC(),
		Cookies: cookie.New(w, r, app.keys...),
		kv:      make(map[interface{}]interface{}),
	}
	if app.serverName != "" {
		ctx.SetHeader(HeaderServer, app.serverName)
	}
	if app.timeout <= 0 {
		ctx.ctx, ctx.cancelCtx = context.WithCancel(r.Context())
	} else {
		ctx.ctx, ctx.cancelCtx = context.WithTimeout(r.Context(), app.timeout)
	}
	ctx.ctx = context.WithValue(ctx.ctx, isInheritedContext, struct{}{})
	ctx.Req = r.WithContext(ctx.ctx)
	if app.withContext != nil {
		ctx.WithContext(app.withContext(ctx.Req))
	}
	ctx.done = ctx.ctx.Done()
	return &ctx
}
func (ctx *Context) Deadline() (time.Time, bool) {
	return ctx.ctx.Deadline()
}
func (ctx *Context) Done() <-chan struct{} {
	return ctx.ctx.Done()
}
func (ctx *Context) Err() error {
	return ctx.ctx.Err()
}
func (ctx *Context) Value(key interface{}) (val interface{}) {
	if key == isGearContext {
		return struct{}{}
	}
	return ctx.ctx.Value(key)
}
func (ctx *Context) Cancel() {
	ctx.Res.ended.setTrue()  
	ctx.Res.afterHooks = nil
	ctx.cancelCtx()
}
func (ctx *Context) WithCancel() (context.Context, context.CancelFunc) {
	return context.WithCancel(ctx.ctx)
}
func (ctx *Context) WithDeadline(deadline time.Time) (context.Context, context.CancelFunc) {
	return context.WithDeadline(ctx.ctx, deadline)
}
func (ctx *Context) WithTimeout(timeout time.Duration) (context.Context, context.CancelFunc) {
	return context.WithTimeout(ctx.ctx, timeout)
}
func (ctx *Context) WithValue(key, val interface{}) context.Context {
	return context.WithValue(ctx.ctx, key, val)
}
func (ctx *Context) Context() context.Context {
	return ctx.ctx
}