Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ethersproject/web

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethersproject/web - npm Package Compare versions

Comparing version 5.0.9 to 5.0.10

src.ts/_version.ts

2

lib.esm/_version.d.ts

@@ -1,1 +0,1 @@

export declare const version = "web/5.0.9";
export declare const version = "web/5.0.10";

@@ -1,2 +0,2 @@

export const version = "web/5.0.9";
export const version = "web/5.0.10";
//# sourceMappingURL=_version.js.map

@@ -11,58 +11,3 @@ "use strict";

};
import http from "http";
import https from "https";
import { gunzipSync } from "zlib";
import { parse } from "url";
import { arrayify, concat } from "@ethersproject/bytes";
import { shallowCopy } from "@ethersproject/properties";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
function getResponse(request) {
return new Promise((resolve, reject) => {
request.once("response", (resp) => {
const response = {
statusCode: resp.statusCode,
statusMessage: resp.statusMessage,
headers: Object.keys(resp.headers).reduce((accum, name) => {
let value = resp.headers[name];
if (Array.isArray(value)) {
value = value.join(", ");
}
accum[name] = value;
return accum;
}, {}),
body: null
};
//resp.setEncoding("utf8");
resp.on("data", (chunk) => {
if (response.body == null) {
response.body = new Uint8Array(0);
}
response.body = concat([response.body, chunk]);
});
resp.on("end", () => {
if (response.headers["content-encoding"] === "gzip") {
//const size = response.body.length;
response.body = arrayify(gunzipSync(response.body));
//console.log("Delta:", response.body.length - size, Buffer.from(response.body).toString());
}
resolve(response);
});
resp.on("error", (error) => {
/* istanbul ignore next */
error.response = response;
reject(error);
});
});
request.on("error", (error) => { reject(error); });
});
}
// The URL.parse uses null instead of the empty string
function nonnull(value) {
if (value == null) {
return "";
}
return value;
}
import { arrayify } from "@ethersproject/bytes";
export function getUrl(href, options) {

@@ -73,40 +18,33 @@ return __awaiter(this, void 0, void 0, function* () {

}
// @TODO: Once we drop support for node 8, we can pass the href
// firectly into request and skip adding the components
// to this request object
const url = parse(href);
const request = {
protocol: nonnull(url.protocol),
hostname: nonnull(url.hostname),
port: nonnull(url.port),
path: (nonnull(url.pathname) + nonnull(url.search)),
method: (options.method || "GET"),
headers: shallowCopy(options.headers || {}),
headers: (options.headers || {}),
body: (options.body || undefined),
mode: "cors",
cache: "no-cache",
credentials: "same-origin",
redirect: "follow",
referrer: "client",
};
if (options.allowGzip) {
request.headers["accept-encoding"] = "gzip";
const response = yield fetch(href, request);
const body = yield response.arrayBuffer();
const headers = {};
if (response.headers.forEach) {
response.headers.forEach((value, key) => {
headers[key.toLowerCase()] = value;
});
}
let req = null;
switch (nonnull(url.protocol)) {
case "http:":
req = http.request(request);
break;
case "https:":
req = https.request(request);
break;
default:
/* istanbul ignore next */
logger.throwError(`unsupported protocol ${url.protocol}`, Logger.errors.UNSUPPORTED_OPERATION, {
protocol: url.protocol,
operation: "request"
});
else {
((response.headers).keys)().forEach((key) => {
headers[key.toLowerCase()] = response.headers.get(key);
});
}
if (options.body) {
req.write(Buffer.from(options.body));
}
req.end();
const response = yield getResponse(req);
return response;
return {
headers: headers,
statusCode: response.status,
statusMessage: response.statusText,
body: arrayify(new Uint8Array(body)),
};
});
}
//# sourceMappingURL=geturl.js.map

@@ -1,1 +0,1 @@

export declare const version = "web/5.0.9";
export declare const version = "web/5.0.10";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "web/5.0.9";
exports.version = "web/5.0.10";
//# sourceMappingURL=_version.js.map
{
"_ethers.alias": {
"geturl.js": "browser-geturl.js"
},
"author": "Richard Moore <me@ricmoo.com>",

@@ -6,8 +9,2 @@ "browser": {

},
"browser.esm": {
"./lib.esm/geturl": "./lib.esm/browser-geturl.js"
},
"browser.umd": {
"./lib/geturl": "./lib/browser-geturl.js"
},
"dependencies": {

@@ -22,3 +19,3 @@ "@ethersproject/base64": "^5.0.3",

"ethereum": "donations.ethers.eth",
"gitHead": "d78b7a39983273a7758399fee33f1b33ec368144",
"gitHead": "8933467c01b64ead547d7c136f22f3c05c85ca1f",
"keywords": [

@@ -42,5 +39,6 @@ "Ethereum",

},
"tarballHash": "0xffb63ec25a04effef1c5201b55770f2636a338339be2a7b770cc5e8914a6d56b",
"sideEffects": false,
"tarballHash": "0x511a65b3468b050eda4b462a1195abe2b7ae0da2154888641e02eaef17c6c681",
"types": "./lib/index.d.ts",
"version": "5.0.9"
"version": "5.0.10"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc