Skip to content

path can be empty string#110

Merged
chimurai merged 2 commits intochimurai:masterfrom
sunnylqm:patch-1
Sep 20, 2016
Merged

path can be empty string#110
chimurai merged 2 commits intochimurai:masterfrom
sunnylqm:patch-1

Conversation

@sunnylqm
Copy link
Copy Markdown
Contributor

No description provided.

@coveralls
Copy link
Copy Markdown

coveralls commented Sep 11, 2016

Coverage Status

Coverage decreased (-0.3%) to 96.875% when pulling a3cdd94 on sunnylqm:patch-1 into 7d1865c on chimurai:master.

@chimurai
Copy link
Copy Markdown
Owner

Please provide a description and test plan for this PR.

@sunnylqm
Copy link
Copy Markdown
Contributor Author

@chimurai for example

{
        path: '/proxy',
        target: 'http:/example.com',
        pathRewrite: () => ''
}

If I want to replace the whole path into an empty string, then it would complain "No rewritten path found"

Comment thread lib/index.js Outdated
var path = pathRewriter(req.url, req);

if (path) {
if (path !== false) {
Copy link
Copy Markdown
Owner

@chimurai chimurai Sep 12, 2016

Choose a reason for hiding this comment

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

Can you change the condition to:

if (typeof path === 'string') {
   ...
}

@chimurai
Copy link
Copy Markdown
Owner

chimurai commented Sep 12, 2016

Testing for a string should be safer.
This will better cope with 'garbage' returned by custom functions...
(Array's, Objects, undefined, etc...)

@coveralls
Copy link
Copy Markdown

coveralls commented Sep 13, 2016

Coverage Status

Coverage decreased (-0.3%) to 96.875% when pulling f597c1d on sunnylqm:patch-1 into 7d1865c on chimurai:master.

@sunnylqm
Copy link
Copy Markdown
Contributor Author

Can it be merged now @chimurai

@chimurai chimurai merged commit 0cb6839 into chimurai:master Sep 20, 2016
@chimurai
Copy link
Copy Markdown
Owner

Sorry for the late response.
Thanks for contributing!

@sunnylqm sunnylqm deleted the patch-1 branch September 21, 2016 00:30
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.

3 participants