@libsql/isomorphic-fetch
Advanced tools
Comparing version 0.2.4 to 0.2.5
19
node.js
@@ -19,21 +19,4 @@ import http from 'http'; | ||
function fetchWithAgentSelection(resource, options = {}) { | ||
let url = resource; | ||
let fetchOptions = options; | ||
if (resource.constructor.name === 'Request') { | ||
url = resource.url; | ||
fetchOptions = { | ||
method: resource.method, | ||
headers: resource.headers, | ||
body: resource.body, | ||
duplex: resource.duplex || "half", | ||
...options | ||
}; | ||
} | ||
const parsedUrl = new URL(url); | ||
const agent = agentSelector(parsedUrl); | ||
return fetch(url, { agent, ...fetchOptions }); | ||
return fetch(resource, { agent: agentSelector, ...options }); | ||
} | ||
export { fetchWithAgentSelection as fetch, _Request as Request, _Headers as Headers}; |
{ | ||
"name": "@libsql/isomorphic-fetch", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "fetch", |
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
4414
90