fix: protect Context.Keys map when call Copy method (#3873)
This commit is contained in:
parent
5f458dd1a6
commit
646312aef6
@ -124,9 +124,11 @@ func (c *Context) Copy() *Context {
|
|||||||
|
|
||||||
cKeys := c.Keys
|
cKeys := c.Keys
|
||||||
cp.Keys = make(map[string]any, len(cKeys))
|
cp.Keys = make(map[string]any, len(cKeys))
|
||||||
|
c.mu.RLock()
|
||||||
for k, v := range cKeys {
|
for k, v := range cKeys {
|
||||||
cp.Keys[k] = v
|
cp.Keys[k] = v
|
||||||
}
|
}
|
||||||
|
c.mu.RUnlock()
|
||||||
|
|
||||||
cParams := c.Params
|
cParams := c.Params
|
||||||
cp.Params = make([]Param, len(cParams))
|
cp.Params = make([]Param, len(cParams))
|
||||||
|
Loading…
Reference in New Issue
Block a user