Socket
Socket
Sign inDemoInstall

got

Package Overview
Dependencies
Maintainers
2
Versions
176
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 10.5.5 to 10.5.6

2

dist/source/known-hook-events.d.ts

@@ -9,3 +9,3 @@ import { CancelableRequest, GeneralError, NormalizedOptions, Options, Response } from './types';

*/
export declare type InitHook = (options: NormalizedOptions) => void;
export declare type InitHook = (options: Options) => void;
/**

@@ -12,0 +12,0 @@ Called with normalized [request options](https://github.com/sindresorhus/got#options). Got will make no further changes to the request before it is sent (except the body serialization). This is especially useful in conjunction with [`got.extend()`](https://github.com/sindresorhus/got#instances) when you want to create an API client that, for example, uses HMAC-signing.

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

exports.normalizeArguments = (url, options, defaults) => {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e, _f, _g;
// Merge options

@@ -230,3 +230,14 @@ if (typeof url === 'undefined') {

}
if (is_1.default.urlInstance(url) || is_1.default.string(url)) {
const runInitHooks = (hooks, options) => {
if (hooks) {
for (const hook of hooks) {
const result = hook(options);
if (is_1.default.promise(result)) {
throw new TypeError('The `init` hook must be a synchronous function');
}
}
}
};
const hasUrl = is_1.default.urlInstance(url) || is_1.default.string(url);
if (hasUrl) {
if (Reflect.has(options, 'url')) {

@@ -237,10 +248,17 @@ throw new TypeError('The `url` option cannot be used if the input is a valid URL.');

options.url = url;
options = exports.mergeOptions((_b = (_a = defaults) === null || _a === void 0 ? void 0 : _a.options, (_b !== null && _b !== void 0 ? _b : {})), options);
runInitHooks((_a = options.hooks) === null || _a === void 0 ? void 0 : _a.init, options);
}
else if (Reflect.has(url, 'resolve')) {
throw new Error('The legacy `url.Url` is deprecated. Use `URL` instead.');
}
else {
if (Reflect.has(url, 'resolve')) {
throw new Error('The legacy `url.Url` is deprecated. Use `URL` instead.');
}
options = exports.mergeOptions((_d = (_c = defaults) === null || _c === void 0 ? void 0 : _c.options, (_d !== null && _d !== void 0 ? _d : {})), url, options);
runInitHooks((_b = url.hooks) === null || _b === void 0 ? void 0 : _b.init, url);
runInitHooks((_c = options.hooks) === null || _c === void 0 ? void 0 : _c.init, options);
}
if (hasUrl) {
options = exports.mergeOptions((_e = (_d = defaults) === null || _d === void 0 ? void 0 : _d.options, (_e !== null && _e !== void 0 ? _e : {})), options);
}
else {
options = exports.mergeOptions((_g = (_f = defaults) === null || _f === void 0 ? void 0 : _f.options, (_g !== null && _g !== void 0 ? _g : {})), url, options);
}
// Normalize URL

@@ -284,8 +302,2 @@ // TODO: drop `optionsToUrl` in Got 12

}
for (const hook of normalizedOptions.hooks.init) {
const result = hook(normalizedOptions);
if (is_1.default.promise(result)) {
throw new TypeError('The `init` hook must be a synchronous function');
}
}
return normalizedOptions;

@@ -292,0 +304,0 @@ };

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

typedResponse.resume(); // We're being redirected, we don't care about the response.
// eslint-disable-next-line @typescript-eslint/no-unnecessary-boolean-literal-compare
if (statusCode === 303 || options.methodRewriting === false) {

@@ -86,0 +87,0 @@ if (options.method !== 'GET' && options.method !== 'HEAD') {

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

@@ -44,3 +44,3 @@ "license": "MIT",

"dependencies": {
"@sindresorhus/is": "^1.0.0",
"@sindresorhus/is": "^2.0.0",
"@szmarczak/http-timer": "^4.0.0",

@@ -59,3 +59,3 @@ "@types/cacheable-request": "^6.0.1",

"to-readable-stream": "^2.0.0",
"type-fest": "^0.9.0"
"type-fest": "^0.10.0"
},

@@ -72,5 +72,5 @@ "devDependencies": {

"@types/tough-cookie": "^2.3.5",
"@typescript-eslint/eslint-plugin": "^2.17.0",
"@typescript-eslint/parser": "^2.17.0",
"ava": "^3.2.0",
"@typescript-eslint/eslint-plugin": "^2.19.2",
"@typescript-eslint/parser": "^2.19.2",
"ava": "^3.3.0",
"coveralls": "^3.0.4",

@@ -80,3 +80,3 @@ "create-test-server": "^3.0.1",

"delay": "^4.3.0",
"eslint-config-xo-typescript": "^0.24.1",
"eslint-config-xo-typescript": "^0.26.0",
"express": "^4.17.1",

@@ -86,5 +86,5 @@ "form-data": "^3.0.0",

"keyv": "^4.0.0",
"lolex": "^5.1.1",
"nock": "^11.3.4",
"np": "^5.1.3",
"lolex": "^6.0.0",
"nock": "^11.8.2",
"np": "^6.0.0",
"nyc": "^15.0.0",

@@ -94,6 +94,6 @@ "proxyquire": "^2.0.1",

"slow-stream": "0.0.4",
"tempy": "^0.3.0",
"tempy": "^0.4.0",
"tough-cookie": "^3.0.0",
"typescript": "3.7.5",
"xo": "^0.25.3"
"xo": "^0.26.0"
},

@@ -100,0 +100,0 @@ "types": "dist/source",

@@ -813,3 +813,3 @@ <div align="center">

If it's not possible to retrieve the body size (can happen when streaming), `total` will be `undefined`.
If the `content-length` header is missing, `total` will be `undefined`.

@@ -816,0 +816,0 @@ ```js

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