fix: protect Context.Keys map when call Copy method (#3873)

This commit is contained in:
qingmu 2024-03-11 22:24:36 +08:00 committed by GitHub
parent 5f458dd1a6
commit 646312aef6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -124,9 +124,11 @@ func (c *Context) Copy() *Context {
cKeys := c.Keys
cp.Keys = make(map[string]any, len(cKeys))
c.mu.RLock()
for k, v := range cKeys {
cp.Keys[k] = v
}
c.mu.RUnlock()
cParams := c.Params
cp.Params = make([]Param, len(cParams))