mirror of https://github.com/gin-gonic/gin.git
adjust Copy method for gin Context
This commit is contained in:
parent
c0418c48e4
commit
3f726c6ad8
|
@ -49,6 +49,7 @@ type Context struct {
|
|||
Writer ResponseWriter
|
||||
|
||||
Params Params
|
||||
// when the operation is not initialized, the default is nil slice
|
||||
handlers HandlersChain
|
||||
index int8
|
||||
fullPath string
|
||||
|
@ -107,12 +108,13 @@ func (c *Context) Copy() *Context {
|
|||
Request: c.Request,
|
||||
Params: c.Params,
|
||||
engine: c.engine,
|
||||
Keys: make(map[string]interface{}, len(c.Keys)),
|
||||
index: abortIndex,
|
||||
handlers: nil,
|
||||
}
|
||||
|
||||
cp.writermem.ResponseWriter = nil
|
||||
cp.Writer = &cp.writermem
|
||||
cp.index = abortIndex
|
||||
cp.handlers = nil
|
||||
cp.Keys = map[string]interface{}{}
|
||||
for k, v := range c.Keys {
|
||||
cp.Keys[k] = v
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue