-
Notifications
You must be signed in to change notification settings - Fork 5
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: implement getAgent function #38
Conversation
for (const [key, value] of Object.entries(process.env)) { | ||
const lowerKey = key.toLowerCase() | ||
if (['https_proxy', 'http_proxy', 'proxy', 'no_proxy'].includes(lowerKey)) { | ||
proxyEnv[lowerKey] = value | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (const [key, value] of Object.entries(process.env)) { | |
const lowerKey = key.toLowerCase() | |
if (['https_proxy', 'http_proxy', 'proxy', 'no_proxy'].includes(lowerKey)) { | |
proxyEnv[lowerKey] = value | |
} | |
} | |
for (const key in process.env) { | |
const lowerKey = key.toLowerCase() | |
if (['https_proxy', 'http_proxy', 'proxy', 'no_proxy'].includes(lowerKey)) { | |
proxyEnv[lowerKey] = process.env[key] | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly, Object.entries
does not return an iterator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will "somewhat" nondeterministically clobber entries w/ duplicated content based on casing and I think we should acknowledge that here in this review and say "Yeah we don't support that"
}) | ||
|
||
if (matches) { | ||
proxy = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is weird, why an empty string instead of null or undefined?
} | ||
|
||
const timeouts = [ | ||
options.timeouts.connection || 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should normalizeOptions do this?
options.timeouts.transfer || 0, | ||
].join('.') | ||
|
||
const maxSockets = options.maxSockets || 15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should normalizeOptions do this/
const key = [ | ||
`https:${isHttps}`, | ||
proxyDescriptor, | ||
`local-address:${options.localAddress || 'null'}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More defaults here, same question about normalizeOptions
note that i chose to remove the lambda specific handling, it doesn't make much sense to me to arbitrarily turn off keepalives just because a fetch is being performed in a lambda.
other than that, this is meant to be functionally equivalent to the
lib/agent.js
file inmake-fetch-happen