-
-
Notifications
You must be signed in to change notification settings - Fork 961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URLParam sometimes returns URL-encoded variables #832
Comments
+1. I'm hitting this same issue too. The logic seems inconsistent.
This URL
extracts contentId as
But this URL
extracts contentId as
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
As the title says, when I try to get a URL parameter from a
http.Request
object (callingchi.URLParam
), it sometimes returns a URL-encoded result, and it only depends on whetherr.URL.RawPath
is set or not.This is because in function
*Mux.routeHTTP()
, it checks ifr.URL.RawPath
is set and uses it instead ofr.URL.Path
; however,r.URL.RawPath
is only present sometimes:chi/mux.go
Lines 420 to 431 in 7f28096
IMHO, the best course of action will be to use
url.EscapedPath()
to get theroutePath
and thenurl.PathUnescape()
to set every value.Simple program to show the bug:
Simple execution to see the problem:
If it is OK for you, I will open a Pull Request.
Thank you very much,
Juan
The text was updated successfully, but these errors were encountered: