Comparing version 14.4.1 to 14.4.2
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { Buffer } from 'node:buffer'; | ||
@@ -3,0 +2,0 @@ import type PCancelable from 'p-cancelable'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { Timings } from '@szmarczak/http-timer'; | ||
@@ -3,0 +2,0 @@ import type Options from './options.js'; |
@@ -1,6 +0,1 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
import { Duplex } from 'node:stream'; | ||
@@ -7,0 +2,0 @@ import { type ClientRequest } from 'node:http'; |
@@ -8,4 +8,3 @@ import process from 'node:process'; | ||
import decompressResponse from 'decompress-response'; | ||
import is from '@sindresorhus/is'; | ||
import { getStreamAsBuffer } from 'get-stream'; | ||
import is, { isBuffer } from '@sindresorhus/is'; | ||
import { FormDataEncoder, isFormData as isFormDataLike } from 'form-data-encoder'; | ||
@@ -631,6 +630,4 @@ import getBodySize from './utils/get-body-size.js'; | ||
// Errors are emitted via the `error` event | ||
const rawBody = await getStreamAsBuffer(from); | ||
// TODO: Switch to this: | ||
// let rawBody = await from.toArray(); | ||
// rawBody = Buffer.concat(rawBody); | ||
const fromArray = await from.toArray(); | ||
const rawBody = isBuffer(fromArray.at(0)) ? Buffer.concat(fromArray) : Buffer.from(fromArray.join('')); | ||
// On retry Request is destroyed with no error, therefore the above will successfully resolve. | ||
@@ -799,3 +796,3 @@ // So in order to check if this was really successfull, we need to check if it has been properly ended. | ||
} | ||
else if (is.null_(headers[key])) { | ||
else if (is.null(headers[key])) { | ||
throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${key}\` header`); | ||
@@ -802,0 +799,0 @@ } |
@@ -1,9 +0,1 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { Buffer } from 'node:buffer'; | ||
@@ -1154,3 +1146,3 @@ import { checkServerIdentity, type SecureContextOptions, type DetailedPeerCertificate } from 'node:tls'; | ||
all: true; | ||
}, callback: (error: NodeJS.ErrnoException | null, result: readonly import("cacheable-lookup").EntryObject[]) => void): void; | ||
}, callback: (error: NodeJS.ErrnoException | null, result: ReadonlyArray<import("cacheable-lookup").EntryObject>) => void): void; | ||
(hostname: string, options: import("cacheable-lookup").LookupOptions, callback: (error: NodeJS.ErrnoException | null, address: string, family: import("cacheable-lookup").IPFamily) => void): void; | ||
@@ -1207,3 +1199,3 @@ } | undefined; | ||
all: true; | ||
}, callback: (error: NodeJS.ErrnoException | null, result: readonly import("cacheable-lookup").EntryObject[]) => void): void; | ||
}, callback: (error: NodeJS.ErrnoException | null, result: ReadonlyArray<import("cacheable-lookup").EntryObject>) => void): void; | ||
(hostname: string, options: import("cacheable-lookup").LookupOptions, callback: (error: NodeJS.ErrnoException | null, address: string, family: import("cacheable-lookup").IPFamily) => void): void; | ||
@@ -1223,4 +1215,4 @@ } | undefined; | ||
auth?: string | null | undefined; | ||
defaultPort?: string | number | undefined; | ||
hints?: number | undefined; | ||
defaultPort?: number | string | undefined; | ||
hints?: import("dns").LookupOptions["hints"]; | ||
host?: string | null | undefined; | ||
@@ -1231,8 +1223,8 @@ hostname?: string | null | undefined; | ||
path?: string | null | undefined; | ||
port?: string | number | null | undefined; | ||
port?: number | string | null | undefined; | ||
protocol?: string | null | undefined; | ||
signal?: AbortSignal | undefined; | ||
socketPath?: string | undefined; | ||
uniqueHeaders?: (string | string[])[] | undefined; | ||
joinDuplicateHeaders?: boolean | undefined; | ||
uniqueHeaders?: Array<string | string[]> | undefined; | ||
joinDuplicateHeaders?: boolean; | ||
ALPNCallback?: ((arg: { | ||
@@ -1250,6 +1242,6 @@ servername: string; | ||
servername?: string | undefined; | ||
shared?: boolean | undefined; | ||
cacheHeuristic?: number | undefined; | ||
immutableMinTimeToLive?: number | undefined; | ||
ignoreCargoCult?: boolean | undefined; | ||
shared?: boolean; | ||
cacheHeuristic?: number; | ||
immutableMinTimeToLive?: number; | ||
ignoreCargoCult?: boolean; | ||
}; | ||
@@ -1256,0 +1248,0 @@ getRequestFunction(): RequestFunction | typeof https.request | undefined; |
@@ -18,3 +18,3 @@ import process from 'node:process'; | ||
const value = searchParameters[key]; | ||
assert.any([is.string, is.number, is.boolean, is.null_, is.undefined], value); | ||
assert.any([is.string, is.number, is.boolean, is.null, is.undefined], value); | ||
} | ||
@@ -417,3 +417,3 @@ } | ||
set request(value) { | ||
assert.any([is.function_, is.undefined], value); | ||
assert.any([is.function, is.undefined], value); | ||
this._internals.request = value; | ||
@@ -735,4 +735,4 @@ } | ||
let { setCookie, getCookieString } = value; | ||
assert.function_(setCookie); | ||
assert.function_(getCookieString); | ||
assert.function(setCookie); | ||
assert.function(getCookieString); | ||
/* istanbul ignore next: Horrible `tough-cookie` v3 check */ | ||
@@ -877,3 +877,3 @@ if (setCookie.length === 4 && getCookieString.length === 0) { | ||
set dnsLookup(value) { | ||
assert.any([is.function_, is.undefined], value); | ||
assert.any([is.function, is.undefined], value); | ||
this._internals.dnsLookup = value; | ||
@@ -968,3 +968,3 @@ } | ||
for (const hook of hooks) { | ||
assert.function_(hook); | ||
assert.function(hook); | ||
} | ||
@@ -1001,3 +1001,3 @@ } | ||
set followRedirect(value) { | ||
assert.any([is.boolean, is.function_], value); | ||
assert.any([is.boolean, is.function], value); | ||
this._internals.followRedirect = value; | ||
@@ -1208,3 +1208,3 @@ } | ||
set parseJson(value) { | ||
assert.function_(value); | ||
assert.function(value); | ||
this._internals.parseJson = value; | ||
@@ -1257,3 +1257,3 @@ } | ||
set stringifyJson(value) { | ||
assert.function_(value); | ||
assert.function(value); | ||
this._internals.stringifyJson = value; | ||
@@ -1288,3 +1288,3 @@ } | ||
assert.plainObject(value); | ||
assert.any([is.function_, is.undefined], value.calculateDelay); | ||
assert.any([is.function, is.undefined], value.calculateDelay); | ||
assert.any([is.number, is.undefined], value.maxRetryAfter); | ||
@@ -1343,3 +1343,3 @@ assert.any([is.number, is.undefined], value.limit); | ||
set createConnection(value) { | ||
assert.any([is.function_, is.undefined], value); | ||
assert.any([is.function, is.undefined], value); | ||
this._internals.createConnection = value; | ||
@@ -1382,3 +1382,3 @@ } | ||
assert.any([is.boolean, is.undefined], value.rejectUnauthorized); | ||
assert.any([is.function_, is.undefined], value.checkServerIdentity); | ||
assert.any([is.function, is.undefined], value.checkServerIdentity); | ||
assert.any([is.string, is.object, is.array, is.undefined], value.certificateAuthority); | ||
@@ -1385,0 +1385,0 @@ assert.any([is.string, is.object, is.array, is.undefined], value.key); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { Buffer } from 'node:buffer'; | ||
@@ -3,0 +2,0 @@ import type { IncomingMessageWithTimings, Timings } from '@szmarczak/http-timer'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { ClientRequest } from 'node:http'; | ||
@@ -3,0 +2,0 @@ declare const reentry: unique symbol; |
@@ -1,3 +0,2 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { ClientRequestArgs } from 'node:http'; | ||
export default function getBodySize(body: unknown, headers: ClientRequestArgs['headers']): Promise<number | undefined>; |
@@ -1,3 +0,1 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { Writable, Readable } from 'node:stream'; | ||
@@ -4,0 +2,0 @@ import type { ClientRequest } from 'node:http'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { Readable } from 'node:stream'; | ||
@@ -3,0 +2,0 @@ type FormData = { |
import is from '@sindresorhus/is'; | ||
export default function isFormData(body) { | ||
return is.nodeStream(body) && is.function_(body.getBoundary); | ||
return is.nodeStream(body) && is.function(body.getBoundary); | ||
} |
@@ -1,3 +0,2 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { EventEmitter } from 'node:events'; | ||
export default function proxyEvents(from: EventEmitter, to: EventEmitter, events: Readonly<string[]>): () => void; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { EventEmitter } from 'node:events'; | ||
@@ -3,0 +2,0 @@ type Origin = EventEmitter; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { UrlWithStringQuery } from 'node:url'; | ||
@@ -3,0 +2,0 @@ export type LegacyUrlOptions = { |
@@ -9,3 +9,3 @@ import is, { assert } from '@sindresorhus/is'; | ||
}); | ||
const isGotInstance = (value) => is.function_(value); | ||
const isGotInstance = (value) => is.function(value); | ||
const aliases = [ | ||
@@ -37,5 +37,5 @@ 'get', | ||
request.options = normalized; | ||
request._noPipe = !normalized.isStream; | ||
request._noPipe = !normalized?.isStream; | ||
void request.flush(); | ||
if (normalized.isStream) { | ||
if (normalized?.isStream) { | ||
return request; | ||
@@ -50,3 +50,3 @@ } | ||
const result = handler(newOptions, iterateHandlers); | ||
if (is.promise(result) && !request.options.isStream) { | ||
if (is.promise(result) && !request.options?.isStream) { | ||
promise ||= asPromise(request); | ||
@@ -99,6 +99,6 @@ if (result !== promise) { | ||
const { pagination } = normalizedOptions; | ||
assert.function_(pagination.transform); | ||
assert.function_(pagination.shouldContinue); | ||
assert.function_(pagination.filter); | ||
assert.function_(pagination.paginate); | ||
assert.function(pagination.transform); | ||
assert.function(pagination.shouldContinue); | ||
assert.function(pagination.filter); | ||
assert.function(pagination.paginate); | ||
assert.number(pagination.countLimit); | ||
@@ -105,0 +105,0 @@ assert.number(pagination.requestLimit); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { Buffer } from 'node:buffer'; | ||
@@ -3,0 +2,0 @@ import type { Spread } from 'type-fest'; |
{ | ||
"name": "got", | ||
"version": "14.4.1", | ||
"version": "14.4.2", | ||
"description": "Human-friendly and powerful HTTP request library for Node.js", | ||
@@ -51,3 +51,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@sindresorhus/is": "^6.3.1", | ||
"@sindresorhus/is": "^7.0.0", | ||
"@szmarczak/http-timer": "^5.0.1", | ||
@@ -58,3 +58,2 @@ "cacheable-lookup": "^7.0.0", | ||
"form-data-encoder": "^4.0.2", | ||
"get-stream": "^8.0.1", | ||
"http2-wrapper": "^2.2.1", | ||
@@ -91,2 +90,3 @@ "lowercase-keys": "^3.0.0", | ||
"formdata-node": "^6.0.3", | ||
"get-stream": "^9.0.1", | ||
"nock": "^13.5.4", | ||
@@ -93,0 +93,0 @@ "node-fetch": "^3.3.2", |
@@ -324,7 +324,7 @@ <div align="center"> | ||
<!-- INSTALL SIZE --> | ||
[gis]: https://badgen.net/packagephobia/install/got?color=blue&label | ||
[kis]: https://badgen.net/packagephobia/install/ky?color=blue&label | ||
[nis]: https://badgen.net/packagephobia/install/node-fetch?color=blue&label | ||
[ais]: https://badgen.net/packagephobia/install/axios?color=blue&label | ||
[sis]: https://badgen.net/packagephobia/install/superagent?color=blue&label | ||
[gis]: https://packagephobia.com/badge?p=got | ||
[kis]: https://packagephobia.com/badge?p=ky | ||
[nis]: https://packagephobia.com/badge?p=node-fetch | ||
[ais]: https://packagephobia.com/badge?p=axios | ||
[sis]: https://packagephobia.com/badge?p=superagent | ||
@@ -378,3 +378,3 @@ [g8]: https://packagephobia.com/result?p=got | ||
[InstallSizeOfTheDependencies]: https://packagephobia.com/result?p=@sindresorhus/is@4.0.1,@szmarczak/http-timer@4.0.5,@types/cacheable-request@6.0.1,@types/responselike@1.0.0,cacheable-lookup@6.0.0,cacheable-request@7.0.2,decompress-response@6.0.0,get-stream@6.0.1,http2-wrapper@2.0.5,lowercase-keys@2.0.0,p-cancelable@2.1.1,responselike@2.0.0 | ||
[InstallSizeOfTheDependencies]: https://packagephobia.com/result?p=@sindresorhus/is@7.0.0,@szmarczak/http-timer@5.0.1,cacheable-lookup@7.0.0,cacheable-request@12.0.1,decompress-response@6.0.0,form-data-encoder@4.0.2,http2-wrapper@2.2.1,lowercase-keys@3.0.0,p-cancelable@4.0.1,responselike@3.0.0,type-fest@4.19.0 | ||
@@ -417,3 +417,3 @@ ## Maintainers | ||
<a href="http://karaokes.moe"> | ||
<img width="140" valign="middle" src="https://camo.githubusercontent.com/6860e5fa4684c14d8e1aa65df0aba4e6808ea1a9/687474703a2f2f6b6172616f6b65732e6d6f652f6173736574732f696d616765732f696e6465782e706e67"> | ||
<img width="140" valign="middle" src="https://karaokes.moe/assets/images/index.png"> | ||
</a> | ||
@@ -423,3 +423,3 @@ </td> | ||
<a href="https://github.com/renovatebot/renovate"> | ||
<img width="150" valign="middle" src="https://camo.githubusercontent.com/7c2dc41a8407d4cfa700f762a1abf46b232858ae7e3a2bf5aee7d9f36416127c/68747470733a2f2f6170702e72656e6f76617465626f742e636f6d2f696d616765732f72656e6f766174655f3636305f3232302e6a7067"> | ||
<img width="150" valign="middle" src="https://avatars.githubusercontent.com/u/38656520?s=200&v=4"> | ||
</a> | ||
@@ -449,7 +449,2 @@ </td> | ||
</td> | ||
<td align="center"> | ||
<a href="https://apify.com"> | ||
<img width="150" valign="middle" src="https://user-images.githubusercontent.com/23726914/128673143-958b5930-b677-40ef-8087-5698a0c29c45.png"> | ||
</a> | ||
</td> | ||
</tr> | ||
@@ -504,5 +499,1 @@ </tbody> | ||
> — <a href="https://github.com/MirzayevFarid">Mirzayev Farid</a> | ||
> Got has been a crucial component of Apify's scraping for years. We use it to extract data from billions of web pages every month, and we really appreciate the powerful API and extensibility, which allowed us to build our own specialized HTTP client on top of Got. The support has always been stellar too. | ||
> | ||
> — <a href="https://github.com/mnmkng">Ondra Urban</a> |
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
11
242437
42
5317
494
+ Added@sindresorhus/is@7.0.1(transitive)
- Removedget-stream@^8.0.1
- Removed@sindresorhus/is@6.3.1(transitive)
- Removedget-stream@8.0.1(transitive)
Updated@sindresorhus/is@^7.0.0