Skip to content
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

Server Options for Router: stripTrailingSlash doesn't work with query string #1755

kungfoochris opened this issue Jul 4, 2014 · 0 comments
bug Bug or defect


Copy link

When attempting to access a route on the hapi server supplying a query string, if the route is setup without a trailing slash and one is supplied it will fail. Even if the router option stripTrailingSlash is set to true.

The code located in the lib/request.js file within the internals.Request.prototype._setUrl method at line 163. It fails due when a query string is in place when it shifts back on the string one character to attempt to detect the slash. It will not find the slash but the last character of the query string.

I was able to get this fixed and I am happy to fork this and generate a pull request if you would like.


  • C
kungfoochris pushed a commit to kungfoochris/hapi that referenced this issue Jul 4, 2014
Fixed a bug where the trailing slash is not ignored when a query string is in use and the option stripTrailingSlash is enabled.
kungfoochris pushed a commit to kungfoochris/hapi that referenced this issue Jul 9, 2014
Added test for the condition where stripTrailingSlash failed if a query string was present. Test fails before the fix. Passes after the fix.
@hueniverse hueniverse added the bug label Jul 14, 2014
@hueniverse hueniverse added this to the 6.1.0 milestone Jul 14, 2014
@hueniverse hueniverse self-assigned this Jul 14, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jan 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
bug Bug or defect
None yet

No branches or pull requests

2 participants