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.4 to 5.0.5

2

lib.esm/_version.d.ts

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

export declare const version = "web/5.0.4";
export declare const version = "web/5.0.5";

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

export const version = "web/5.0.4";
export const version = "web/5.0.5";
//# sourceMappingURL=_version.js.map

@@ -12,2 +12,3 @@ "use strict";

import { encode as base64Encode } from "@ethersproject/base64";
import { hexlify, isBytesLike } from "@ethersproject/bytes";
import { shallowCopy } from "@ethersproject/properties";

@@ -24,2 +25,21 @@ import { toUtf8Bytes, toUtf8String } from "@ethersproject/strings";

}
function bodyify(value, type) {
if (value == null) {
return null;
}
if (typeof (value) === "string") {
return value;
}
if (isBytesLike(value)) {
if (type && (type.split("/")[0] === "text" || type === "application/json")) {
try {
return toUtf8String(value);
}
catch (error) { }
;
}
return hexlify(value);
}
return value;
}
// This API is still a work in progress; the future changes will likely be:

@@ -99,3 +119,3 @@ // - ConnectionInfo => FetchDataRequest<T = any>

reject(logger.makeError("timeout", Logger.errors.TIMEOUT, {
requestBody: (options.body || null),
requestBody: bodyify(options.body, flatHeaders["content-type"]),
requestMethod: options.method,

@@ -149,3 +169,3 @@ timeout: timeout,

logger.throwError("missing response", Logger.errors.SERVER_ERROR, {
requestBody: (options.body || null),
requestBody: bodyify(options.body, flatHeaders["content-type"]),
requestMethod: options.method,

@@ -166,4 +186,4 @@ serverError: error,

headers: response.headers,
body: body,
requestBody: (options.body || null),
body: bodyify(body, ((response.headers) ? response.headers["content-type"] : null)),
requestBody: bodyify(options.body, flatHeaders["content-type"]),
requestMethod: options.method,

@@ -195,5 +215,5 @@ url: url

logger.throwError("processing response error", Logger.errors.SERVER_ERROR, {
body: body,
body: bodyify(body, ((response.headers) ? response.headers["content-type"] : null)),
error: error,
requestBody: (options.body || null),
requestBody: bodyify(options.body, flatHeaders["content-type"]),
requestMethod: options.method,

@@ -210,3 +230,3 @@ url: url

return logger.throwError("failed response", Logger.errors.SERVER_ERROR, {
requestBody: (options.body || null),
requestBody: bodyify(options.body, flatHeaders["content-type"]),
requestMethod: options.method,

@@ -213,0 +233,0 @@ url: url

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

export declare const version = "web/5.0.4";
export declare const version = "web/5.0.5";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "web/5.0.4";
exports.version = "web/5.0.5";
//# sourceMappingURL=_version.js.map

@@ -40,2 +40,3 @@ "use strict";

var base64_1 = require("@ethersproject/base64");
var bytes_1 = require("@ethersproject/bytes");
var properties_1 = require("@ethersproject/properties");

@@ -52,2 +53,21 @@ var strings_1 = require("@ethersproject/strings");

}
function bodyify(value, type) {
if (value == null) {
return null;
}
if (typeof (value) === "string") {
return value;
}
if (bytes_1.isBytesLike(value)) {
if (type && (type.split("/")[0] === "text" || type === "application/json")) {
try {
return strings_1.toUtf8String(value);
}
catch (error) { }
;
}
return bytes_1.hexlify(value);
}
return value;
}
// This API is still a work in progress; the future changes will likely be:

@@ -127,3 +147,3 @@ // - ConnectionInfo => FetchDataRequest<T = any>

reject(logger.makeError("timeout", logger_1.Logger.errors.TIMEOUT, {
requestBody: (options.body || null),
requestBody: bodyify(options.body, flatHeaders["content-type"]),
requestMethod: options.method,

@@ -192,3 +212,3 @@ timeout: timeout,

logger.throwError("missing response", logger_1.Logger.errors.SERVER_ERROR, {
requestBody: (options.body || null),
requestBody: bodyify(options.body, flatHeaders["content-type"]),
requestMethod: options.method,

@@ -210,4 +230,4 @@ serverError: error_1,

headers: response.headers,
body: body_1,
requestBody: (options.body || null),
body: bodyify(body_1, ((response.headers) ? response.headers["content-type"] : null)),
requestBody: bodyify(options.body, flatHeaders["content-type"]),
requestMethod: options.method,

@@ -247,5 +267,5 @@ url: url

logger.throwError("processing response error", logger_1.Logger.errors.SERVER_ERROR, {
body: body_1,
body: bodyify(body_1, ((response.headers) ? response.headers["content-type"] : null)),
error: error_2,
requestBody: (options.body || null),
requestBody: bodyify(options.body, flatHeaders["content-type"]),
requestMethod: options.method,

@@ -264,3 +284,3 @@ url: url

case 19: return [2 /*return*/, logger.throwError("failed response", logger_1.Logger.errors.SERVER_ERROR, {
requestBody: (options.body || null),
requestBody: bodyify(options.body, flatHeaders["content-type"]),
requestMethod: options.method,

@@ -267,0 +287,0 @@ url: url

@@ -39,5 +39,5 @@ {

},
"tarballHash": "0x52afee0d86baef8eb43567a2d9ab4ad1f4c90a9dfc48acbb9c4b8285f9e7b2c0",
"tarballHash": "0x88202b25f3f0b7966bdaf7f6eee99ca39a2680b68ac0871a750d349866f17727",
"types": "./lib/index.d.ts",
"version": "5.0.4"
"version": "5.0.5"
}

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