-
Notifications
You must be signed in to change notification settings - Fork 177
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
Upgrade path to regexp #71
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/pillarjs/path-to-regexp/blob/master/History.md#200--2017-08-23 > Explicitly handle trailing delimiters instead of trimming them (e.g. /test/ is now treated as /test/ instead of /test when matching)
v9.0.0 released to npm https://github.com/koajs/router/releases/tag/v9.0.0 |
3imed-jaberi
added a commit
to 3imed-jaberi/koa-router
that referenced
this pull request
May 28, 2020
This reverts commit 92df918.
ide
added a commit
to ide/koa-router
that referenced
this pull request
Mar 4, 2021
The main breaking change from v8.x to v9.x was an upgrade to `path-to-regex`. [That PR](koajs#71) alluded to a breaking change in encoding. Namely, parameters were not URL-encoded: parameters with safe special characters (like spaces) were not percent-encoded, and parameters with special characters that mean something in a URL, such as slashes (path separators) and question marks (query string delimiter). The motivation for this PR is to make URL-encoding be the default since typically the parameters provided to `Router.url` are plain, unencoded values. Should someone need an escape hatch, they could pass in `{ encode: null }` (I think) to disable the automatic encoding. Updated tests, docs, and the changelog.
ide
added a commit
to ide/koa-router
that referenced
this pull request
Jul 18, 2022
The main breaking change from v8.x to v9.x was an upgrade to `path-to-regex`. [That PR](koajs#71) alluded to a breaking change in encoding. Namely, parameters were not URL-encoded: parameters with safe special characters (like spaces) were not percent-encoded, and parameters with special characters that mean something in a URL, such as slashes (path separators) and question marks (query string delimiter). The motivation for this PR is to make URL-encoding be the default since typically the parameters provided to `Router.url` are plain, unencoded values. Should someone need an escape hatch, they could pass in `{ encode: null }` (I think) to disable the automatic encoding. Updated tests and docs.
titanism
pushed a commit
that referenced
this pull request
Jul 19, 2022
The main breaking change from v8.x to v9.x was an upgrade to `path-to-regex`. [That PR](#71) alluded to a breaking change in encoding. Namely, parameters were not URL-encoded: parameters with safe special characters (like spaces) were not percent-encoded, and parameters with special characters that mean something in a URL, such as slashes (path separators) and question marks (query string delimiter). The motivation for this PR is to make URL-encoding be the default since typically the parameters provided to `Router.url` are plain, unencoded values. Should someone need an escape hatch, they could pass in `{ encode: null }` (I think) to disable the automatic encoding. Updated tests and docs.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Upgrade
path-to-regexp
from 1.x to ^6.xthen:
path-to-regexp
encode/decode being by default the identity functionx => x
... send the options tocompile
and be explicit in the testspath-to-regexp@2.0
breaking change regarding explicit trailing slash handling https://github.com/pillarjs/path-to-regexp/blob/0c466b1b0944e8d0022b5b15069364a8483bf9c5/History.md#200--2017-08-23 ... I added tests, it should not be a breaking change for us because I added a specific behavior whenpath === '/'
and prefix, we can target trailing slash by using the strict option.should fixes #40
should be a straight upgrade over #70
Maybe breaking change (major semver) related to the encode/decode situation.