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

got

Package Overview
Dependencies
Maintainers
2
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

got - npm Package Compare versions

Comparing version 11.0.0 to 11.0.1

11

dist/source/as-promise/core.js

@@ -110,13 +110,4 @@ "use strict";

}
try {
for (const hook of this.options.hooks.beforeError) {
// eslint-disable-next-line no-await-in-loop
error = await hook(error);
}
}
catch (error_) {
this.destroy(new core_1.RequestError(error_.message, error_, this));
return;
}
// Let the promise decide whether to abort or not
// It is also responsible for the `beforeError` hook
this.emit('error', error);

@@ -123,0 +114,0 @@ }

16

dist/source/as-promise/index.js

@@ -26,3 +26,3 @@ "use strict";

const emitter = new events_1.EventEmitter();
const promise = new PCancelable((resolve, reject, onCancel) => {
const promise = new PCancelable((resolve, _reject, onCancel) => {
const makeRequest = () => {

@@ -37,5 +37,19 @@ // Support retries

}
// Note from @szmarczak: I think we should use `request.options` instead of the local options
const request = new core_1.default(options.url, options);
request._noPipe = true;
onCancel(() => request.destroy());
const reject = async (error) => {
try {
for (const hook of options.hooks.beforeError) {
// eslint-disable-next-line no-await-in-loop
error = await hook(error);
}
}
catch (error_) {
_reject(new types_1.RequestError(error_.message, error_, request));
return;
}
_reject(error);
};
globalRequest = request;

@@ -42,0 +56,0 @@ request.once('response', async (response) => {

@@ -200,2 +200,4 @@ /// <reference types="node" />

readonly response: Response;
readonly request: Request;
readonly timings: Timings;
constructor(request: Request);

@@ -205,11 +207,16 @@ }

readonly response: Response;
readonly request: Request;
readonly timings: Timings;
constructor(response: Response);
}
export declare class CacheError extends RequestError {
readonly request: Request;
constructor(error: Error, request: Request);
}
export declare class UploadError extends RequestError {
readonly request: Request;
constructor(error: Error, request: Request);
}
export declare class TimeoutError extends RequestError {
readonly request: Request;
readonly timings: Timings;

@@ -220,2 +227,5 @@ readonly event: string;

export declare class ReadError extends RequestError {
readonly request: Request;
readonly response: Response;
readonly timings: Timings;
constructor(error: Error, request: Request);

@@ -222,0 +232,0 @@ }

@@ -275,3 +275,3 @@ "use strict";

static normalizeArguments(url, options, defaults) {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f;
const rawOptions = options;

@@ -333,4 +333,7 @@ if (is_1.default.object(url) && !is_1.default.urlInstance(url)) {

}
else if (options.headers === ((_a = defaults) === null || _a === void 0 ? void 0 : _a.headers)) {
options.headers = { ...options.headers };
}
else {
options.headers = lowercaseKeys({ ...((_a = defaults) === null || _a === void 0 ? void 0 : _a.headers), ...options.headers });
options.headers = lowercaseKeys({ ...((_b = defaults) === null || _b === void 0 ? void 0 : _b.headers), ...options.headers });
}

@@ -394,4 +397,4 @@ // Disallow legacy `url.Url`

// `options.username` & `options.password`
options.username = (_b = options.username, (_b !== null && _b !== void 0 ? _b : ''));
options.password = (_c = options.password, (_c !== null && _c !== void 0 ? _c : ''));
options.username = (_c = options.username, (_c !== null && _c !== void 0 ? _c : ''));
options.password = (_d = options.password, (_d !== null && _d !== void 0 ? _d : ''));
if (options.url) {

@@ -412,4 +415,4 @@ options.url.username = options.username;

options.cookieJar = {
setCookie: setCookie.bind(cookieJar),
getCookieString: getCookieString.bind(getCookieString)
setCookie,
getCookieString
};

@@ -453,3 +456,3 @@ }

}
else if (defaults) {
else if (defaults && options.timeout !== defaults.timeout) {
options.timeout = {

@@ -468,2 +471,3 @@ ...defaults.timeout,

// `options.hooks`
const areHooksUserDefined = options.hooks !== ((_e = defaults) === null || _e === void 0 ? void 0 : _e.hooks);
options.hooks = { ...options.hooks };

@@ -484,3 +488,3 @@ for (const event of exports.knownHookEvents) {

}
if (defaults) {
if (defaults && areHooksUserDefined) {
for (const event of exports.knownHookEvents) {

@@ -508,3 +512,3 @@ const defaultHooks = defaults.hooks[event];

}
options.maxRedirects = (_d = options.maxRedirects, (_d !== null && _d !== void 0 ? _d : 0));
options.maxRedirects = (_f = options.maxRedirects, (_f !== null && _f !== void 0 ? _f : 0));
// Set non-enumerable properties

@@ -511,0 +515,0 @@ setNonEnumerableProperties([defaults, options], options);

{
"name": "got",
"version": "11.0.0",
"version": "11.0.1",
"description": "Human-friendly and powerful HTTP request library for Node.js",

@@ -5,0 +5,0 @@ "license": "MIT",

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