You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
…rValues
This change fixes Request.Clone to correctly work with SetPathValue
by creating fresh copies for matches and otherValues so that
SetPathValue for cloned requests doesn't pollute the original request.
While here, also added a doc for Request.SetPathValue.
Fixesgolang#64911
Change-Id: I2831b38e135935dfaea2b939bb9db554c75b65ef
GitHub-Last-Rev: 1981db1
GitHub-Pull-Request: golang#64913
Reviewed-on: https://go-review.googlesource.com/c/go/+/553375
Reviewed-by: Emmanuel Odeke <[email protected]>
Run-TryBot: Jes Cok <[email protected]>
Auto-Submit: Dmitri Shuralyov <[email protected]>
Reviewed-by: Jonathan Amsterdam <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Go version
go version go1.22rc1 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
I tried using the new
Request.PathValue
andRequest.SetPathValue
methods introduced in #61410 together withRequest.Clone
.Code:
Playground Link: https://go.dev/play/p/gz8wPsLmz6u?v=gotip
What did you expect to see?
Request.Clone
s documentation statesThus I expect calls to
SetPathValue
on one request object to not affect the values returned byPathValue
on the other request object.What did you see instead?
Changes to the path values of one request also affect the other. See the example code and the playground example.
The reason for this is that
Clone
does not create copies ofr.matches
andr.otherValues
.The text was updated successfully, but these errors were encountered: