-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Mux not properly parsing ampersand in url query paramters #238
Comments
I'm also now noticing a similar issue with encoded "?" (%3F). If I set up Query params and an encoded "?" is present, I'll get a 404 since mux won't match the path. |
Okay, This is definitely broken. LUCKILY, there is a gorilla mux way of fixing it. You have to use the route.Queries() and give it a {name:pattern} for it to use (using {query:.+} fixes my above issue). If you give route.Queries() just {name}, it will fail with the example url I gave above. Hope this helps someone down the road. |
Open to documentation PRs for this!
…On Tue, Mar 28, 2017 at 1:44 PM Micah Willard ***@***.***> wrote:
Okay, This is definitely broken. LUCKILY, there is a gorilla mux way of
fixing it. You have to use the route.Queries() and give it a {name:pattern}
for it to use (using {query:.+} fixes my above issue). If you give
route.Queries() just {name}, it will fail with the example url I gave
above. Hope this helps someone down the road.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#238 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABIcJAAvsIq5y5MJUn_fFaQCx5xtkJdks5rqXEugaJpZM4MReOu>
.
|
Reproduces and fixes gorilla#238.
When I execute and perform a request on the following code at
url: localhost:3000/?query=Business%20Management%20%26%20Administration
:I get the following results for my prints:
I'm not 100% sure if it is mux, but something seems to not properly handle the ampersand. In the print for the "r.URL.RawQuery" you can see a literal "&" where a url encoded ampersand should be ("%26") and that messes up the parsing of everything else. Am I mistaken?
I created a httptest program without mux (here) and everything came out right, so that is why I am thinking something in mux might be the cause. I apologize in advance if this is something simple that I am simply missing. Thanks for your time!
The text was updated successfully, but these errors were encountered: