support $no_proxy#192
Conversation
|
@stephenmichaelf could you take a look at this ❤️ ❤️ ❤️ |
|
Will take a look today! Thanks. |
| }; | ||
|
|
||
| this.options.proxy = proxyFromEnv; | ||
| if (!process.env.no_proxy || process.env.no_proxy.toLowerCase().split(',').indexOf(url.parse(this.serverUrl).host) !== -1) { |
There was a problem hiding this comment.
@gforceg @nschonni Has this been tested to make sure it works as desired? I think this is backwards. It should be === instead of !==, right? We are trying to enter this block of code only if the server host is not in no_proxy.
var no_proxy = 'www.google.com';
var serverUrlHost = 'www.google.com';
if (!no_proxy || no_proxy.toLowerCase().split(',').indexOf(serverUrlHost) === -1) {
console.log('allowed setting proxy');
}
else {
console.log('skipped setting proxy');
}
Also probably want toLowerCase on serverUrl if url.parse doesn't do that for you.
I'm not opposed to extracting the logic to a function.
There was a problem hiding this comment.
Think you're right. Looking at https://github.com/request/request/blob/b12a6245d9acdb1e13c6486d427801e123fdafae/lib/getProxyFromURI.js there may be some additional logic needed too
There was a problem hiding this comment.
Thanks for the link Nick, appreciate it. IMO all the more reason to extract this to a method.
@gforceg Could you make the suggested changes? Thanks! Appreciate the contribution.
There was a problem hiding this comment.
@gforceg any updates? Are you still planning on submitting this PR?
There was a problem hiding this comment.
Sorry for the delay on this.
First I was on vacation then I was doing other work.
I wrapped the functionality into a function and then rebased.
Can you provide guidance on where I can stick a unit test?
samples/common.ts mentions proxy but I'm still trying to understand the how the samples / tests work in this project.
There was a problem hiding this comment.
haha I just noticed the tests directory.
Added a unit test. Still needs to be e2e tested.
@nschonni, can you give this a try?
|
This looks good to me, thanks for the contribution/follow up! @stephenmichaelf are you good with merging? |
|
Just double checked, this looks good, I'm going to merge. Thanks for the contribution! |
if the host of the TFS instance is listed in the $no_proxy variable do
not set options.proxy
Feature request #183