@ethersproject/web
Advanced tools
Comparing version 5.4.0 to 5.5.0
@@ -1,2 +0,2 @@ | ||
export declare const version = "web/5.4.0"; | ||
export declare const version = "web/5.5.0"; | ||
//# sourceMappingURL=_version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const version = "web/5.4.0"; | ||
export const version = "web/5.5.0"; | ||
//# sourceMappingURL=_version.js.map |
@@ -21,8 +21,11 @@ "use strict"; | ||
body: (options.body || undefined), | ||
mode: "cors", | ||
cache: "no-cache", | ||
credentials: "same-origin", | ||
redirect: "follow", | ||
referrer: "client", // no-referrer, *client | ||
}; | ||
if (options.skipFetchSetup !== true) { | ||
request.mode = "cors"; // no-cors, cors, *same-origin | ||
request.cache = "no-cache"; // *default, no-cache, reload, force-cache, only-if-cached | ||
request.credentials = "same-origin"; // include, *same-origin, omit | ||
request.redirect = "follow"; // manual, *follow, error | ||
request.referrer = "client"; // no-referrer, *client | ||
} | ||
; | ||
const response = yield fetch(href, request); | ||
@@ -29,0 +32,0 @@ const body = yield response.arrayBuffer(); |
@@ -223,3 +223,3 @@ "use strict"; | ||
runningTimeout.cancel(); | ||
// If we had a processFunc, it eitehr returned a T or threw above. | ||
// If we had a processFunc, it either returned a T or threw above. | ||
// The "body" is now a Uint8Array. | ||
@@ -226,0 +226,0 @@ return body; |
@@ -16,3 +16,4 @@ export declare type GetUrlResponse = { | ||
}; | ||
skipFetchSetup?: boolean; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const version = "web/5.4.0"; | ||
export declare const version = "web/5.5.0"; | ||
//# sourceMappingURL=_version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = "web/5.4.0"; | ||
exports.version = "web/5.5.0"; | ||
//# sourceMappingURL=_version.js.map |
@@ -54,8 +54,11 @@ "use strict"; | ||
body: (options.body || undefined), | ||
mode: "cors", | ||
cache: "no-cache", | ||
credentials: "same-origin", | ||
redirect: "follow", | ||
referrer: "client", // no-referrer, *client | ||
}; | ||
if (options.skipFetchSetup !== true) { | ||
request.mode = "cors"; // no-cors, cors, *same-origin | ||
request.cache = "no-cache"; // *default, no-cache, reload, force-cache, only-if-cached | ||
request.credentials = "same-origin"; // include, *same-origin, omit | ||
request.redirect = "follow"; // manual, *follow, error | ||
request.referrer = "client"; // no-referrer, *client | ||
} | ||
; | ||
return [4 /*yield*/, fetch(href, request)]; | ||
@@ -82,3 +85,3 @@ case 1: | ||
statusMessage: response.statusText, | ||
body: bytes_1.arrayify(new Uint8Array(body)), | ||
body: (0, bytes_1.arrayify)(new Uint8Array(body)), | ||
}]; | ||
@@ -85,0 +88,0 @@ } |
@@ -73,3 +73,3 @@ "use strict"; | ||
} | ||
response.body = bytes_1.concat([response.body, chunk]); | ||
response.body = (0, bytes_1.concat)([response.body, chunk]); | ||
}); | ||
@@ -79,3 +79,3 @@ resp.on("end", function () { | ||
//const size = response.body.length; | ||
response.body = bytes_1.arrayify(zlib_1.gunzipSync(response.body)); | ||
response.body = (0, bytes_1.arrayify)((0, zlib_1.gunzipSync)(response.body)); | ||
//console.log("Delta:", response.body.length - size, Buffer.from(response.body).toString()); | ||
@@ -110,3 +110,3 @@ } | ||
} | ||
url = url_1.parse(href); | ||
url = (0, url_1.parse)(href); | ||
request = { | ||
@@ -118,3 +118,3 @@ protocol: nonnull(url.protocol), | ||
method: (options.method || "GET"), | ||
headers: properties_1.shallowCopy(options.headers || {}), | ||
headers: (0, properties_1.shallowCopy)(options.headers || {}), | ||
}; | ||
@@ -121,0 +121,0 @@ if (options.allowGzip) { |
@@ -60,6 +60,6 @@ "use strict"; | ||
} | ||
if (bytes_1.isBytesLike(value)) { | ||
if ((0, bytes_1.isBytesLike)(value)) { | ||
if (type && (type.split("/")[0] === "text" || type.split(";")[0].trim() === "application/json")) { | ||
try { | ||
return strings_1.toUtf8String(value); | ||
return (0, strings_1.toUtf8String)(value); | ||
} | ||
@@ -69,3 +69,3 @@ catch (error) { } | ||
} | ||
return bytes_1.hexlify(value); | ||
return (0, bytes_1.hexlify)(value); | ||
} | ||
@@ -122,3 +122,3 @@ return value; | ||
key: "Authorization", | ||
value: "Basic " + base64_1.encode(strings_1.toUtf8Bytes(authorization)) | ||
value: "Basic " + (0, base64_1.encode)((0, strings_1.toUtf8Bytes)(authorization)) | ||
}; | ||
@@ -184,3 +184,3 @@ } | ||
_a.trys.push([2, 8, , 9]); | ||
return [4 /*yield*/, geturl_1.getUrl(url, options)]; | ||
return [4 /*yield*/, (0, geturl_1.getUrl)(url, options)]; | ||
case 3: | ||
@@ -280,3 +280,3 @@ response = _a.sent(); | ||
runningTimeout.cancel(); | ||
// If we had a processFunc, it eitehr returned a T or threw above. | ||
// If we had a processFunc, it either returned a T or threw above. | ||
// The "body" is now a Uint8Array. | ||
@@ -304,3 +304,3 @@ return [2 /*return*/, body_1]; | ||
try { | ||
result = JSON.parse(strings_1.toUtf8String(value)); | ||
result = JSON.parse((0, strings_1.toUtf8String)(value)); | ||
} | ||
@@ -324,9 +324,9 @@ catch (error) { | ||
if (json != null) { | ||
body = strings_1.toUtf8Bytes(json); | ||
body = (0, strings_1.toUtf8Bytes)(json); | ||
// Create a connection with the content-type set for JSON | ||
var updated = (typeof (connection) === "string") ? ({ url: connection }) : properties_1.shallowCopy(connection); | ||
var updated = (typeof (connection) === "string") ? ({ url: connection }) : (0, properties_1.shallowCopy)(connection); | ||
if (updated.headers) { | ||
var hasContentType = (Object.keys(updated.headers).filter(function (k) { return (k.toLowerCase() === "content-type"); }).length) !== 0; | ||
if (!hasContentType) { | ||
updated.headers = properties_1.shallowCopy(updated.headers); | ||
updated.headers = (0, properties_1.shallowCopy)(updated.headers); | ||
updated.headers["content-type"] = "application/json"; | ||
@@ -347,3 +347,3 @@ } | ||
} | ||
options = properties_1.shallowCopy(options); | ||
options = (0, properties_1.shallowCopy)(options); | ||
if (options.floor == null) { | ||
@@ -350,0 +350,0 @@ options.floor = 0; |
@@ -16,3 +16,4 @@ export declare type GetUrlResponse = { | ||
}; | ||
skipFetchSetup?: boolean; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -10,7 +10,7 @@ { | ||
"dependencies": { | ||
"@ethersproject/base64": "^5.4.0", | ||
"@ethersproject/bytes": "^5.4.0", | ||
"@ethersproject/logger": "^5.4.0", | ||
"@ethersproject/properties": "^5.4.0", | ||
"@ethersproject/strings": "^5.4.0" | ||
"@ethersproject/base64": "^5.5.0", | ||
"@ethersproject/bytes": "^5.5.0", | ||
"@ethersproject/logger": "^5.5.0", | ||
"@ethersproject/properties": "^5.5.0", | ||
"@ethersproject/strings": "^5.5.0" | ||
}, | ||
@@ -29,3 +29,3 @@ "description": "Utility fucntions for managing web requests for ethers.", | ||
], | ||
"gitHead": "c2c0ce75039e7256b287f9a764188d08ed0b7296", | ||
"gitHead": "73a46efea32c3f9a4833ed77896a216e3d3752a0", | ||
"keywords": [ | ||
@@ -51,5 +51,5 @@ "Ethereum", | ||
"sideEffects": false, | ||
"tarballHash": "0x8a35c297b7c665ca35d6d9e2f50e63fd5b1d23554400559965ec373d19656a2a", | ||
"tarballHash": "0x1ba437b3de41bf55152c0e51b659134b7c3f58caeb50aeb65f1c3c5d81b622de", | ||
"types": "./lib/index.d.ts", | ||
"version": "5.4.0" | ||
"version": "5.5.0" | ||
} |
@@ -1,1 +0,1 @@ | ||
export const version = "web/5.4.0"; | ||
export const version = "web/5.5.0"; |
@@ -12,12 +12,14 @@ "use strict"; | ||
const request = { | ||
const request: RequestInit = { | ||
method: (options.method || "GET"), | ||
headers: (options.headers || { }), | ||
body: (options.body || undefined), | ||
}; | ||
mode: <RequestMode>"cors", // no-cors, cors, *same-origin | ||
cache: <RequestCache>"no-cache", // *default, no-cache, reload, force-cache, only-if-cached | ||
credentials: <RequestCredentials>"same-origin", // include, *same-origin, omit | ||
redirect: <RequestRedirect>"follow", // manual, *follow, error | ||
referrer: "client", // no-referrer, *client | ||
if (options.skipFetchSetup !== true) { | ||
request.mode = <RequestMode>"cors"; // no-cors, cors, *same-origin | ||
request.cache = <RequestCache>"no-cache"; // *default, no-cache, reload, force-cache, only-if-cached | ||
request.credentials = <RequestCredentials>"same-origin"; // include, *same-origin, omit | ||
request.redirect = <RequestRedirect>"follow"; // manual, *follow, error | ||
request.referrer = "client"; // no-referrer, *client | ||
}; | ||
@@ -24,0 +26,0 @@ |
@@ -72,3 +72,3 @@ "use strict"; | ||
// @TODO: Once we drop support for node 8, we can pass the href | ||
// firectly into request and skip adding the components | ||
// directly into request and skip adding the components | ||
// to this request object | ||
@@ -75,0 +75,0 @@ const url = parse(href); |
@@ -296,3 +296,3 @@ "use strict"; | ||
// If we had a processFunc, it eitehr returned a T or threw above. | ||
// If we had a processFunc, it either returned a T or threw above. | ||
// The "body" is now a Uint8Array. | ||
@@ -299,0 +299,0 @@ return <T>(<unknown>body); |
"use strict"; | ||
export type GetUrlResponse = { | ||
statusCode: number, | ||
statusCode: number; | ||
statusMessage: string; | ||
@@ -11,7 +11,8 @@ headers: { [ key: string] : string }; | ||
export type Options = { | ||
method?: string, | ||
method?: string; | ||
allowGzip?: boolean; | ||
body?: Uint8Array | ||
headers?: { [ key: string] : string }, | ||
body?: Uint8Array; | ||
headers?: { [ key: string] : string }; | ||
skipFetchSetup?: boolean; | ||
}; | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
113893
1676