Skip to content

Commit

Permalink
Merge pull request #2300 from mook-as/node-fetch-type-update
Browse files Browse the repository at this point in the history
utils/fetch: support options.agent being a boolean.
  • Loading branch information
ericpromislow committed May 31, 2022
2 parents aeb6c11 + 08fae06 commit a63f72f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ export default async function fetch(url: string, options?: RequestInit) {
let agent: http.Agent;

if (options?.agent) {
if (options.agent instanceof http.Agent) {
agent = options.agent;
} else {
if (typeof options.agent === 'function') {
agent = options.agent(parsedURL);
} else {
agent = options.agent;
}
} else {
agent = isSecure ? https.globalAgent : http.globalAgent;
Expand Down

0 comments on commit a63f72f

Please sign in to comment.