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

Add an option to disable case-sensitive routing #84

Merged
merged 5 commits into from Jul 2, 2018

Conversation

mcollina
Copy link
Collaborator

@mcollina mcollina commented Jun 30, 2018

See fastify/fastify#1007.

@thearegee would this work for you?

@mcollina mcollina requested a review from delvedor June 30, 2018 13:48
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.9%) to 96.404% when pulling 0653af5 on case-sensitive-param into 57b6577 on master.

6 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.9%) to 96.404% when pulling 0653af5 on case-sensitive-param into 57b6577 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.9%) to 96.404% when pulling 0653af5 on case-sensitive-param into 57b6577 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.9%) to 96.404% when pulling 0653af5 on case-sensitive-param into 57b6577 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.9%) to 96.404% when pulling 0653af5 on case-sensitive-param into 57b6577 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.9%) to 96.404% when pulling 0653af5 on case-sensitive-param into 57b6577 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.9%) to 96.404% when pulling 0653af5 on case-sensitive-param into 57b6577 on master.

@coveralls
Copy link

coveralls commented Jun 30, 2018

Coverage Status

Coverage increased (+0.06%) to 97.372% when pulling 1e501eb on case-sensitive-param into 57b6577 on master.

@robinglen
Copy link

@mcollina this looks perfect, could just do with a note maybe in the README?
Just so people know its available

@mcollina
Copy link
Collaborator Author

Done.

README.md Outdated
@@ -75,6 +75,19 @@ const router = require('find-my-way')({
allowUnsafeRegex: true
})
```

According to [RFC3986](https://tools.ietf.org/html/rfc3986#section-6.2.2.1find-my-way), Fastify is case sensitive by default.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think the anchor is wrong, includes find-my-way after the section number

index.js Outdated
@@ -308,6 +320,9 @@ Router.prototype.lookup = function lookup (req, res) {
}

Router.prototype.find = function find (method, path, version) {
if (!this.caseSensitive) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (this.caseSensitive === false)?
It should make V8 happier (but I'm not super sure because the value is already a Boolean).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

Copy link
Owner

@delvedor delvedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add also a test where you check what happens if the user registers a parameter with an uppercase letter?
Eg: /test/:Param

@mcollina
Copy link
Collaborator Author

mcollina commented Jul 2, 2018

@delvedor updated.

Copy link
Owner

@delvedor delvedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants