Disable encoding on url segments
I was trying to rewrite all urls that looked like a/b/:path+ to c/d/:path, so in practice:
a/b/file => c/d/file
a/b/dir/dir/dir/file => c/d/dir/dir/file
However, it didn't work. After some digging I found that path-to-regexp was encoding the slashes in the matched url segment.
However, you can pass a custom encoder, so I've added an option on rewrite objects to use an identity function (value => value), so no character gets encoded in the URL. I've named it raw but I'm open to suggestions.
There's a minor detail, you also have to provide the regex for the destintation, because by default they disallow certain characters there as well. I've added an example to the README mentioning this too. Also, a small test case.
Codecov Report
Merging #85 into master will not change coverage. The diff coverage is
100%.
@@ Coverage Diff @@
## master #85 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 2 2
Lines 324 324
=====================================
Hits 324 324
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/index.js | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 9101d15...1751eaf. Read the comment docs.
I wonder what happened to this PR. Seems still valid to me.