Skip to content

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

@kungfoochris

Description

@kungfoochris

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.

Thanks,

  • C

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions