Closed gsych closed 4 years ago
Hi @savsgio !
Thank you for your reply. Yes, it was clear why this happens from the beginning. Still, I think there should be a note about that in the documentation or a comment to the UserValue func or anywhere else, otherwise in my opinion it's really misleading. I've spent several hours trying to figure out why the hell I have a data corruption and never had a second thought that I actually have to allocate a new copy. Having a proper allocation in the UserValue usage example would definitely prevent this.
Thank you for your effort!
Hi @gsych,
Sorry for remove my answer, but i think the better solution it's save a copy directly to the user values and avoid confusions in a future.
I will upload the fix now.
Fixed 😉
Thanks for your issue!
Superb!
Hello @savsgio,
Looks like this issue still exists for regex params. Here no copy of path is made, so it is possible to have values corrupted.
Added a PR with tests: #52. @savsgio Pls take a look.
Hi there! :)
I've prepared a short snippet program localizing the issue: go.mod:
main.go:
Then I make the following requests, one after another:
curl --location --request PATCH 'http://127.0.0.1:8080/api/v1/path/aaabbbcccdddzzz'
curl --location --request GET 'http://127.0.0.1:8080/api/v1/path/special-path'
The output I expect to see:
The actual output:
As you can see the
special-path
path part overwrites part of theaaabbbcccdddzzz
word.