@whatwg-node/node-fetch
Advanced tools
Comparing version 0.5.17-alpha-20240726115125-ab31308a7b0579cdd0a19007f92db672cf1eaa85 to 0.5.17-alpha-20240726134117-83e8f8204e0f1386db741961d187a4ea92d82686
@@ -5,2 +5,4 @@ "use strict"; | ||
exports.PonyfillRequest = void 0; | ||
const http_1 = require("http"); | ||
const https_1 = require("https"); | ||
const Body_js_1 = require("./Body.js"); | ||
@@ -79,3 +81,19 @@ const Headers_js_1 = require("./Headers.js"); | ||
} | ||
this._agent = requestInit?.agent; | ||
} | ||
get agent() { | ||
if (this._agent != null) { | ||
return this._agent; | ||
} | ||
// Disable agent when running in jest | ||
if (globalThis['libcurl'] || typeof jest === 'object') { | ||
return false; | ||
} | ||
if (this.url.startsWith('http:')) { | ||
return http_1.globalAgent; | ||
} | ||
else if (this.url.startsWith('https:')) { | ||
return https_1.globalAgent; | ||
} | ||
} | ||
get signal() { | ||
@@ -82,0 +100,0 @@ // Create a new signal only if needed |
var _a; | ||
import { globalAgent as httpGlobalAgent } from 'http'; | ||
import { globalAgent as httpsGlobalAgent } from 'https'; | ||
import { PonyfillBody } from './Body.js'; | ||
@@ -75,3 +77,19 @@ import { isHeadersLike, PonyfillHeaders } from './Headers.js'; | ||
} | ||
this._agent = requestInit?.agent; | ||
} | ||
get agent() { | ||
if (this._agent != null) { | ||
return this._agent; | ||
} | ||
// Disable agent when running in jest | ||
if (globalThis['libcurl'] || typeof jest === 'object') { | ||
return false; | ||
} | ||
if (this.url.startsWith('http:')) { | ||
return httpGlobalAgent; | ||
} | ||
else if (this.url.startsWith('https:')) { | ||
return httpsGlobalAgent; | ||
} | ||
} | ||
get signal() { | ||
@@ -78,0 +96,0 @@ // Create a new signal only if needed |
{ | ||
"name": "@whatwg-node/node-fetch", | ||
"version": "0.5.17-alpha-20240726115125-ab31308a7b0579cdd0a19007f92db672cf1eaa85", | ||
"version": "0.5.17-alpha-20240726134117-83e8f8204e0f1386db741961d187a4ea92d82686", | ||
"description": "Fetch API implementation for Node", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
@@ -1,2 +0,3 @@ | ||
import { Agent } from 'http'; | ||
import { Agent as HTTPAgent } from 'http'; | ||
import { Agent as HTTPSAgent } from 'https'; | ||
import { BodyPonyfillInit, PonyfillBody, PonyfillBodyOptions } from './Body.js'; | ||
@@ -9,3 +10,3 @@ import { PonyfillHeadersInit } from './Headers.js'; | ||
headersSerializer?: HeadersSerializer; | ||
agent?: Agent; | ||
agent?: HTTPAgent | HTTPSAgent | false; | ||
}; | ||
@@ -29,4 +30,5 @@ type HeadersSerializer = (headers: Headers, onContentLength?: (contentLength: string) => void) => string[]; | ||
url: string; | ||
agent?: Agent; | ||
duplex: 'half' | 'full'; | ||
private _agent; | ||
get agent(): false | HTTPAgent | undefined; | ||
private _signal; | ||
@@ -33,0 +35,0 @@ get signal(): AbortSignal; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
197296
5043
10