-
Notifications
You must be signed in to change notification settings - Fork 58
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
Posting a html form doesn't work with trailing slash redirect. #7
Comments
The router returns a 301 redirect to make the browser point to the version with/without the trailing slash. I did a bit of research and it appears that in this case the browser will just do a GET request to the redirected location instead of a POST with the original data. Is this the case that you're seeing? If so, I think the best solution here is to add an option to the router to not do a redirect, but instead to just call the handler. I might have time to add such a feature this week, but not sure yet. If you'd like to take it on and submit a pull request I'll be glad to look it over. |
Hi dimfeld, Thanks! |
Quick update, I have some code written to make the redirect behavior more flexible, including an option to just call the handler like you want. Still need to write tests and update the docs for it which I hopefully will get to do some time next week. |
That sounds good. |
Hi,
thanks for making this router. I'm trying it out right now.
However, I encountered this weird behavior:
I have a html form that does a POST to
/admin/register/
(notice the trailing slash).When I use httptreemux like this:
the
postRegistrationHandler
isn't called.But when I use httptreemux like this:
it works just fine.
This seems to be a problem with redirection, right? Maybe because I defined the GET method without a trailing slash?
Thanks
The text was updated successfully, but these errors were encountered: