-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat: add decodeFullUrl option #57
base: master
Are you sure you want to change the base?
Conversation
Changes onDecode signature to (req, options) instead of (req, res, next), because options are useful when decoding the url but res and next are never used (and I couldn't find a usecase).
Codecov Report
@@ Coverage Diff @@
## master #57 +/- ##
============================================
- Coverage 100.00% 84.44% -15.56%
============================================
Files 2 2
Lines 37 45 +8
Branches 8 13 +5
============================================
+ Hits 37 38 +1
- Misses 0 3 +3
- Partials 0 4 +4
Continue to review full report at Codecov.
|
@P4sca1 could you update the tests as well please? |
Never done this before, could you give me some advices? |
Sure! The tests are in the repo. A way to change the config dynamically is shown @ https://github.com/nuxt-community/redirect-module/blob/master/test/module.test.js#L107-L114 But you could also use multiple fixtures as shown in e.g. https://github.com/nuxt-community/style-resources-module/tree/master/test/fixture |
@manniL I finally found some time to make myself a little bit familiar with jest. |
Nice feature, which I would love to use. What are the plans about merging this PR? This also would fix #73 |
Adds an option
decodeFullUrl
to also add protocol and host to the url.This allows for http to https or www to non-www redirects for example.
README is also updated and contains a new example for using this option.
Also changes onDecode signature to (req, options) instead of (req, res, next), because options are useful when decoding the url but res and next are never used (and I couldn't find a use case).