got 14.0.0 → 14.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/source/core/errors.d.ts +4 -4
- package/dist/source/core/errors.js +2 -1
- package/dist/source/core/index.d.ts +0 -1
- package/dist/source/core/index.js +1 -0
- package/dist/source/core/options.d.ts +1 -2
- package/dist/source/core/response.d.ts +0 -1
- package/dist/source/core/utils/is-unix-socket-url.d.ts +0 -1
- package/dist/source/core/utils/options-to-url.d.ts +0 -1
- package/dist/source/types.d.ts +0 -1
- package/package.json +1 -1
|
@@ -9,12 +9,12 @@ type Error = NodeJS.ErrnoException;
|
|
|
9
9
|
An error to be thrown when a request fails.
|
|
10
10
|
Contains a `code` property with error class code, like `ECONNREFUSED`.
|
|
11
11
|
*/
|
|
12
|
-
export declare class RequestError extends Error {
|
|
12
|
+
export declare class RequestError<T = unknown> extends Error {
|
|
13
13
|
input?: string;
|
|
14
14
|
code: string;
|
|
15
15
|
stack: string;
|
|
16
16
|
readonly options: Options;
|
|
17
|
-
readonly response?: Response
|
|
17
|
+
readonly response?: Response<T>;
|
|
18
18
|
readonly request?: Request;
|
|
19
19
|
readonly timings?: Timings;
|
|
20
20
|
constructor(message: string, error: Partial<Error & {
|
|
@@ -35,8 +35,8 @@ export declare class MaxRedirectsError extends RequestError {
|
|
|
35
35
|
An error to be thrown when the server response code is not 2xx nor 3xx if `options.followRedirect` is `true`, but always except for 304.
|
|
36
36
|
Includes a `response` property.
|
|
37
37
|
*/
|
|
38
|
-
export declare class HTTPError extends RequestError {
|
|
39
|
-
readonly response: Response
|
|
38
|
+
export declare class HTTPError<T = any> extends RequestError<T> {
|
|
39
|
+
readonly response: Response<T>;
|
|
40
40
|
readonly request: Request;
|
|
41
41
|
readonly timings: Timings;
|
|
42
42
|
constructor(response: PlainResponse);
|
|
@@ -15,7 +15,7 @@ export class RequestError extends Error {
|
|
|
15
15
|
request;
|
|
16
16
|
timings;
|
|
17
17
|
constructor(message, error, self) {
|
|
18
|
-
super(message);
|
|
18
|
+
super(message, { cause: error });
|
|
19
19
|
Error.captureStackTrace(this, this.constructor);
|
|
20
20
|
this.name = 'RequestError';
|
|
21
21
|
this.code = error.code ?? 'ERR_GOT_REQUEST_ERROR';
|
|
@@ -63,6 +63,7 @@ export class MaxRedirectsError extends RequestError {
|
|
|
63
63
|
An error to be thrown when the server response code is not 2xx nor 3xx if `options.followRedirect` is `true`, but always except for 304.
|
|
64
64
|
Includes a `response` property.
|
|
65
65
|
*/
|
|
66
|
+
// TODO: Change `HTTPError<T = any>` to `HTTPError<T = unknown>` in the next major version to enforce type usage.
|
|
66
67
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
67
68
|
export class HTTPError extends RequestError {
|
|
68
69
|
constructor(response) {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
/// <reference types="node" resolution-mode="require"/>
|
|
4
4
|
/// <reference types="node" resolution-mode="require"/>
|
|
5
5
|
/// <reference types="node" resolution-mode="require"/>
|
|
6
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
7
6
|
import { Duplex } from 'node:stream';
|
|
8
7
|
import { type ClientRequest } from 'node:http';
|
|
9
8
|
import type { Socket } from 'node:net';
|
|
@@ -485,6 +485,7 @@ export default class Request extends Duplex {
|
|
|
485
485
|
if (is.object(options.cookieJar) && rawCookies) {
|
|
486
486
|
let promises = rawCookies.map(async (rawCookie) => options.cookieJar.setCookie(rawCookie, url.toString()));
|
|
487
487
|
if (options.ignoreInvalidCookies) {
|
|
488
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
488
489
|
promises = promises.map(async (promise) => {
|
|
489
490
|
try {
|
|
490
491
|
await promise;
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
/// <reference types="node" resolution-mode="require"/>
|
|
7
7
|
/// <reference types="node" resolution-mode="require"/>
|
|
8
8
|
/// <reference types="node" resolution-mode="require"/>
|
|
9
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
10
9
|
import type { Buffer } from 'node:buffer';
|
|
11
10
|
import { checkServerIdentity, type SecureContextOptions, type DetailedPeerCertificate } from 'node:tls';
|
|
12
11
|
import https, { type RequestOptions as HttpsRequestOptions, type Agent as HttpsAgent } from 'node:https';
|
|
@@ -1146,7 +1145,7 @@ export default class Options {
|
|
|
1146
1145
|
cookieJar: PromiseCookieJar | ToughCookieJar | undefined;
|
|
1147
1146
|
signal: AbortSignal | undefined;
|
|
1148
1147
|
ignoreInvalidCookies: boolean;
|
|
1149
|
-
searchParams: string |
|
|
1148
|
+
searchParams: string | URLSearchParams | SearchParameters | undefined;
|
|
1150
1149
|
dnsLookup: {
|
|
1151
1150
|
(hostname: string, family: import("cacheable-lookup").IPFamily, callback: (error: NodeJS.ErrnoException | null, address: string, family: import("cacheable-lookup").IPFamily) => void): void;
|
|
1152
1151
|
(hostname: string, callback: (error: NodeJS.ErrnoException | null, address: string, family: import("cacheable-lookup").IPFamily) => void): void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
2
|
import type { Buffer } from 'node:buffer';
|
|
4
3
|
import type { IncomingMessageWithTimings, Timings } from '@szmarczak/http-timer';
|
|
5
4
|
import { RequestError } from './errors.js';
|
package/dist/source/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
2
|
import type { Buffer } from 'node:buffer';
|
|
4
3
|
import type { CancelableRequest } from './as-promise/types.js';
|
|
5
4
|
import type { Response } from './core/response.js';
|