@depup/got 14.6.6-depup.1

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.
Files changed (53) hide show
  1. package/README.md +36 -0
  2. package/changes.json +30 -0
  3. package/dist/source/as-promise/index.d.ts +3 -0
  4. package/dist/source/as-promise/index.js +204 -0
  5. package/dist/source/as-promise/types.d.ts +37 -0
  6. package/dist/source/as-promise/types.js +17 -0
  7. package/dist/source/core/calculate-retry-delay.d.ts +4 -0
  8. package/dist/source/core/calculate-retry-delay.js +29 -0
  9. package/dist/source/core/diagnostics-channel.d.ts +89 -0
  10. package/dist/source/core/diagnostics-channel.js +49 -0
  11. package/dist/source/core/errors.d.ts +102 -0
  12. package/dist/source/core/errors.js +147 -0
  13. package/dist/source/core/index.d.ts +192 -0
  14. package/dist/source/core/index.js +1339 -0
  15. package/dist/source/core/options.d.ts +1564 -0
  16. package/dist/source/core/options.js +1838 -0
  17. package/dist/source/core/parse-link-header.d.ts +4 -0
  18. package/dist/source/core/parse-link-header.js +33 -0
  19. package/dist/source/core/response.d.ts +109 -0
  20. package/dist/source/core/response.js +41 -0
  21. package/dist/source/core/timed-out.d.ts +31 -0
  22. package/dist/source/core/timed-out.js +136 -0
  23. package/dist/source/core/utils/defer-to-connect.d.ts +9 -0
  24. package/dist/source/core/utils/defer-to-connect.js +44 -0
  25. package/dist/source/core/utils/get-body-size.d.ts +2 -0
  26. package/dist/source/core/utils/get-body-size.js +37 -0
  27. package/dist/source/core/utils/is-client-request.d.ts +4 -0
  28. package/dist/source/core/utils/is-client-request.js +4 -0
  29. package/dist/source/core/utils/is-form-data.d.ts +7 -0
  30. package/dist/source/core/utils/is-form-data.js +4 -0
  31. package/dist/source/core/utils/is-unix-socket-url.d.ts +17 -0
  32. package/dist/source/core/utils/is-unix-socket-url.js +25 -0
  33. package/dist/source/core/utils/options-to-url.d.ts +12 -0
  34. package/dist/source/core/utils/options-to-url.js +48 -0
  35. package/dist/source/core/utils/proxy-events.d.ts +2 -0
  36. package/dist/source/core/utils/proxy-events.js +15 -0
  37. package/dist/source/core/utils/timer.d.ts +31 -0
  38. package/dist/source/core/utils/timer.js +162 -0
  39. package/dist/source/core/utils/unhandle.d.ts +10 -0
  40. package/dist/source/core/utils/unhandle.js +20 -0
  41. package/dist/source/core/utils/url-to-options.d.ts +14 -0
  42. package/dist/source/core/utils/url-to-options.js +22 -0
  43. package/dist/source/core/utils/weakable-map.d.ts +7 -0
  44. package/dist/source/core/utils/weakable-map.js +24 -0
  45. package/dist/source/create.d.ts +3 -0
  46. package/dist/source/create.js +188 -0
  47. package/dist/source/index.d.ts +16 -0
  48. package/dist/source/index.js +22 -0
  49. package/dist/source/types.d.ts +314 -0
  50. package/dist/source/types.js +1 -0
  51. package/license +9 -0
  52. package/package.json +197 -0
  53. package/readme.md +478 -0
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # @depup/got
2
+
3
+ > Dependency-bumped version of [got](https://www.npmjs.com/package/got)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/got
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [got](https://www.npmjs.com/package/got) @ 14.6.6 |
17
+ | Processed | 2026-03-19 |
18
+ | Smoke test | passed |
19
+ | Deps updated | 6 |
20
+
21
+ ## Dependency Changes
22
+
23
+ | Dependency | From | To |
24
+ |------------|------|-----|
25
+ | @sindresorhus/is | ^7.0.1 | ^7.2.0 |
26
+ | cacheable-request | ^13.0.12 | ^13.0.18 |
27
+ | form-data-encoder | ^4.0.2 | ^4.1.0 |
28
+ | keyv | ^5.5.3 | ^5.6.0 |
29
+ | lowercase-keys | ^3.0.0 | ^4.0.1 |
30
+ | type-fest | ^4.26.1 | ^5.5.0 |
31
+
32
+ ---
33
+
34
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/got
35
+
36
+ License inherited from the original package.
package/changes.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "bumped": {
3
+ "@sindresorhus/is": {
4
+ "from": "^7.0.1",
5
+ "to": "^7.2.0"
6
+ },
7
+ "cacheable-request": {
8
+ "from": "^13.0.12",
9
+ "to": "^13.0.18"
10
+ },
11
+ "form-data-encoder": {
12
+ "from": "^4.0.2",
13
+ "to": "^4.1.0"
14
+ },
15
+ "keyv": {
16
+ "from": "^5.5.3",
17
+ "to": "^5.6.0"
18
+ },
19
+ "lowercase-keys": {
20
+ "from": "^3.0.0",
21
+ "to": "^4.0.1"
22
+ },
23
+ "type-fest": {
24
+ "from": "^4.26.1",
25
+ "to": "^5.5.0"
26
+ }
27
+ },
28
+ "timestamp": "2026-03-19T08:19:48.316Z",
29
+ "totalUpdated": 6
30
+ }
@@ -0,0 +1,3 @@
1
+ import Request from '../core/index.js';
2
+ import { type CancelableRequest } from './types.js';
3
+ export default function asPromise<T>(firstRequest?: Request): CancelableRequest<T>;
@@ -0,0 +1,204 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import is from '@sindresorhus/is';
3
+ import PCancelable from 'p-cancelable';
4
+ import { HTTPError, RetryError, } from '../core/errors.js';
5
+ import Request from '../core/index.js';
6
+ import { parseBody, isResponseOk, ParseError, } from '../core/response.js';
7
+ import proxyEvents from '../core/utils/proxy-events.js';
8
+ import { CancelError } from './types.js';
9
+ const proxiedRequestEvents = [
10
+ 'request',
11
+ 'response',
12
+ 'redirect',
13
+ 'uploadProgress',
14
+ 'downloadProgress',
15
+ ];
16
+ export default function asPromise(firstRequest) {
17
+ let globalRequest;
18
+ let globalResponse;
19
+ let normalizedOptions;
20
+ const emitter = new EventEmitter();
21
+ let promiseSettled = false;
22
+ const promise = new PCancelable((resolve, reject, onCancel) => {
23
+ onCancel(() => {
24
+ globalRequest.destroy();
25
+ });
26
+ onCancel.shouldReject = false;
27
+ onCancel(() => {
28
+ promiseSettled = true;
29
+ reject(new CancelError(globalRequest));
30
+ });
31
+ const makeRequest = (retryCount) => {
32
+ // Errors when a new request is made after the promise settles.
33
+ // Used to detect a race condition.
34
+ // See https://github.com/sindresorhus/got/issues/1489
35
+ onCancel(() => { });
36
+ const request = firstRequest ?? new Request(undefined, undefined, normalizedOptions);
37
+ request.retryCount = retryCount;
38
+ request._noPipe = true;
39
+ globalRequest = request;
40
+ request.once('response', async (response) => {
41
+ // Parse body
42
+ const contentEncoding = (response.headers['content-encoding'] ?? '').toLowerCase();
43
+ const isCompressed = contentEncoding === 'gzip' || contentEncoding === 'deflate' || contentEncoding === 'br' || contentEncoding === 'zstd';
44
+ const { options } = request;
45
+ if (isCompressed && !options.decompress) {
46
+ response.body = response.rawBody;
47
+ }
48
+ else {
49
+ try {
50
+ response.body = parseBody(response, options.responseType, options.parseJson, options.encoding);
51
+ }
52
+ catch (error) {
53
+ // Fall back to `utf8`
54
+ try {
55
+ response.body = response.rawBody.toString();
56
+ }
57
+ catch (error) {
58
+ request._beforeError(new ParseError(error, response));
59
+ return;
60
+ }
61
+ if (isResponseOk(response)) {
62
+ request._beforeError(error);
63
+ return;
64
+ }
65
+ }
66
+ }
67
+ try {
68
+ const hooks = options.hooks.afterResponse;
69
+ for (const [index, hook] of hooks.entries()) {
70
+ // @ts-expect-error TS doesn't notice that CancelableRequest is a Promise
71
+ // eslint-disable-next-line no-await-in-loop
72
+ response = await hook(response, async (updatedOptions) => {
73
+ const preserveHooks = updatedOptions.preserveHooks ?? false;
74
+ options.merge(updatedOptions);
75
+ options.prefixUrl = '';
76
+ if (updatedOptions.url) {
77
+ options.url = updatedOptions.url;
78
+ }
79
+ // Remove any further hooks for that request, because we'll call them anyway.
80
+ // The loop continues. We don't want duplicates (asPromise recursion).
81
+ // Unless preserveHooks is true, in which case we keep the remaining hooks.
82
+ if (!preserveHooks) {
83
+ options.hooks.afterResponse = options.hooks.afterResponse.slice(0, index);
84
+ }
85
+ throw new RetryError(request);
86
+ });
87
+ if (!(is.object(response) && is.number(response.statusCode) && 'body' in response)) {
88
+ throw new TypeError('The `afterResponse` hook returned an invalid value');
89
+ }
90
+ }
91
+ }
92
+ catch (error) {
93
+ request._beforeError(error);
94
+ return;
95
+ }
96
+ globalResponse = response;
97
+ if (!isResponseOk(response)) {
98
+ request._beforeError(new HTTPError(response));
99
+ return;
100
+ }
101
+ request.destroy();
102
+ promiseSettled = true;
103
+ resolve(request.options.resolveBodyOnly ? response.body : response);
104
+ });
105
+ let handledFinalError = false;
106
+ const onError = (error) => {
107
+ if (promise.isCanceled) {
108
+ return;
109
+ }
110
+ // Route errors emitted directly on the stream (e.g., EPIPE from Node.js)
111
+ // through retry logic first, then handle them here after retries are exhausted.
112
+ // See https://github.com/sindresorhus/got/issues/1995
113
+ if (!request._stopReading) {
114
+ request._beforeError(error);
115
+ return;
116
+ }
117
+ // Allow the manual re-emission from Request to land only once.
118
+ if (handledFinalError) {
119
+ return;
120
+ }
121
+ handledFinalError = true;
122
+ promiseSettled = true;
123
+ const { options } = request;
124
+ if (error instanceof HTTPError && !options.throwHttpErrors) {
125
+ const { response } = error;
126
+ request.destroy();
127
+ resolve(request.options.resolveBodyOnly ? response.body : response);
128
+ return;
129
+ }
130
+ reject(error);
131
+ };
132
+ // Use .on() instead of .once() to keep the listener active across retries.
133
+ // When _stopReading is false, we return early and the error gets re-emitted
134
+ // after retry logic completes, so we need this listener to remain active.
135
+ // See https://github.com/sindresorhus/got/issues/1995
136
+ request.on('error', onError);
137
+ const previousBody = request.options?.body;
138
+ request.once('retry', (newRetryCount, error) => {
139
+ firstRequest = undefined;
140
+ // If promise already settled, don't retry
141
+ // This prevents the race condition in #1489 where a late error
142
+ // (e.g., ECONNRESET after successful response) triggers retry
143
+ // after the promise has already resolved/rejected
144
+ if (promiseSettled) {
145
+ return;
146
+ }
147
+ const newBody = request.options.body;
148
+ if (previousBody === newBody && is.nodeStream(newBody)) {
149
+ error.message = 'Cannot retry with consumed body stream';
150
+ onError(error);
151
+ return;
152
+ }
153
+ // This is needed! We need to reuse `request.options` because they can get modified!
154
+ // For example, by calling `promise.json()`.
155
+ normalizedOptions = request.options;
156
+ makeRequest(newRetryCount);
157
+ });
158
+ proxyEvents(request, emitter, proxiedRequestEvents);
159
+ if (is.undefined(firstRequest)) {
160
+ void request.flush();
161
+ }
162
+ };
163
+ makeRequest(0);
164
+ });
165
+ promise.on = (event, function_) => {
166
+ emitter.on(event, function_);
167
+ return promise;
168
+ };
169
+ promise.off = (event, function_) => {
170
+ emitter.off(event, function_);
171
+ return promise;
172
+ };
173
+ const shortcut = (promiseToAwait, responseType) => {
174
+ const newPromise = (async () => {
175
+ // Wait until downloading has ended
176
+ await promiseToAwait;
177
+ const { options } = globalResponse.request;
178
+ return parseBody(globalResponse, responseType, options.parseJson, options.encoding);
179
+ })();
180
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
181
+ Object.defineProperties(newPromise, Object.getOwnPropertyDescriptors(promiseToAwait));
182
+ return newPromise;
183
+ };
184
+ // Note: These use `function` syntax (not arrows) to access `this` context.
185
+ // When custom handlers wrap the promise to transform errors, these methods
186
+ // are copied to the handler's promise. Using `this` ensures we await the
187
+ // handler's wrapped promise, not the original, so errors propagate correctly.
188
+ promise.json = function () {
189
+ if (globalRequest.options) {
190
+ const { headers } = globalRequest.options;
191
+ if (!globalRequest.writableFinished && !('accept' in headers)) {
192
+ headers.accept = 'application/json';
193
+ }
194
+ }
195
+ return shortcut(this, 'json');
196
+ };
197
+ promise.buffer = function () {
198
+ return shortcut(this, 'buffer');
199
+ };
200
+ promise.text = function () {
201
+ return shortcut(this, 'text');
202
+ };
203
+ return promise;
204
+ }
@@ -0,0 +1,37 @@
1
+ import type { Buffer } from 'node:buffer';
2
+ import type PCancelable from 'p-cancelable';
3
+ import { RequestError } from '../core/errors.js';
4
+ import type Request from '../core/index.js';
5
+ import { type RequestEvents } from '../core/index.js';
6
+ import type { Response } from '../core/response.js';
7
+ /**
8
+ An error to be thrown when the request is aborted with `.cancel()`.
9
+ */
10
+ export declare class CancelError extends RequestError {
11
+ readonly response: Response;
12
+ constructor(request: Request);
13
+ /**
14
+ Whether the promise is canceled.
15
+ */
16
+ get isCanceled(): boolean;
17
+ }
18
+ export interface CancelableRequest<T extends Response | Response['body'] = Response['body']> extends PCancelable<T>, RequestEvents<CancelableRequest<T>> {
19
+ /**
20
+ A shortcut method that gives a Promise returning a JSON object.
21
+
22
+ It is semantically the same as settings `options.resolveBodyOnly` to `true` and `options.responseType` to `'json'`.
23
+ */
24
+ json: <ReturnType>() => CancelableRequest<ReturnType>;
25
+ /**
26
+ A shortcut method that gives a Promise returning a [Buffer](https://nodejs.org/api/buffer.html).
27
+
28
+ It is semantically the same as settings `options.resolveBodyOnly` to `true` and `options.responseType` to `'buffer'`.
29
+ */
30
+ buffer: () => CancelableRequest<Buffer>;
31
+ /**
32
+ A shortcut method that gives a Promise returning a string.
33
+
34
+ It is semantically the same as settings `options.resolveBodyOnly` to `true` and `options.responseType` to `'text'`.
35
+ */
36
+ text: () => CancelableRequest<string>;
37
+ }
@@ -0,0 +1,17 @@
1
+ import { RequestError } from '../core/errors.js';
2
+ /**
3
+ An error to be thrown when the request is aborted with `.cancel()`.
4
+ */
5
+ export class CancelError extends RequestError {
6
+ constructor(request) {
7
+ super('Promise was canceled', {}, request);
8
+ this.name = 'CancelError';
9
+ this.code = 'ERR_CANCELED';
10
+ }
11
+ /**
12
+ Whether the promise is canceled.
13
+ */
14
+ get isCanceled() {
15
+ return true;
16
+ }
17
+ }
@@ -0,0 +1,4 @@
1
+ import type { RetryFunction } from './options.js';
2
+ type Returns<T extends (...arguments_: any) => unknown, V> = (...arguments_: Parameters<T>) => V;
3
+ declare const calculateRetryDelay: Returns<RetryFunction, number>;
4
+ export default calculateRetryDelay;
@@ -0,0 +1,29 @@
1
+ const calculateRetryDelay = ({ attemptCount, retryOptions, error, retryAfter, computedValue, }) => {
2
+ if (error.name === 'RetryError') {
3
+ return 1;
4
+ }
5
+ if (attemptCount > retryOptions.limit) {
6
+ return 0;
7
+ }
8
+ const hasMethod = retryOptions.methods.includes(error.options.method);
9
+ const hasErrorCode = retryOptions.errorCodes.includes(error.code);
10
+ const hasStatusCode = error.response && retryOptions.statusCodes.includes(error.response.statusCode);
11
+ if (!hasMethod || (!hasErrorCode && !hasStatusCode)) {
12
+ return 0;
13
+ }
14
+ if (error.response) {
15
+ if (retryAfter) {
16
+ // In this case `computedValue` is `options.request.timeout`
17
+ if (retryAfter > computedValue) {
18
+ return 0;
19
+ }
20
+ return retryAfter;
21
+ }
22
+ if (error.response.statusCode === 413) {
23
+ return 0;
24
+ }
25
+ }
26
+ const noise = Math.random() * retryOptions.noise;
27
+ return Math.min(((2 ** (attemptCount - 1)) * 1000), retryOptions.backoffLimit) + noise;
28
+ };
29
+ export default calculateRetryDelay;
@@ -0,0 +1,89 @@
1
+ import type { Timings } from './utils/timer.js';
2
+ import type { RequestError } from './errors.js';
3
+ export type RequestId = string;
4
+ /**
5
+ Message for the `got:request:create` diagnostic channel.
6
+
7
+ Emitted when a request is created.
8
+ */
9
+ export type DiagnosticRequestCreate = {
10
+ requestId: RequestId;
11
+ url: string;
12
+ method: string;
13
+ };
14
+ /**
15
+ Message for the `got:request:start` diagnostic channel.
16
+
17
+ Emitted before the native HTTP request is sent.
18
+ */
19
+ export type DiagnosticRequestStart = {
20
+ requestId: RequestId;
21
+ url: string;
22
+ method: string;
23
+ headers: Record<string, string | string[] | undefined>;
24
+ };
25
+ /**
26
+ Message for the `got:response:start` diagnostic channel.
27
+
28
+ Emitted when response headers are received.
29
+ */
30
+ export type DiagnosticResponseStart = {
31
+ requestId: RequestId;
32
+ url: string;
33
+ statusCode: number;
34
+ headers: Record<string, string | string[] | undefined>;
35
+ isFromCache: boolean;
36
+ };
37
+ /**
38
+ Message for the `got:response:end` diagnostic channel.
39
+
40
+ Emitted when the response completes.
41
+ */
42
+ export type DiagnosticResponseEnd = {
43
+ requestId: RequestId;
44
+ url: string;
45
+ statusCode: number;
46
+ bodySize?: number;
47
+ timings?: Timings;
48
+ };
49
+ /**
50
+ Message for the `got:request:retry` diagnostic channel.
51
+
52
+ Emitted when retrying a request.
53
+ */
54
+ export type DiagnosticRequestRetry = {
55
+ requestId: RequestId;
56
+ retryCount: number;
57
+ error: RequestError;
58
+ delay: number;
59
+ };
60
+ /**
61
+ Message for the `got:request:error` diagnostic channel.
62
+
63
+ Emitted when a request fails.
64
+ */
65
+ export type DiagnosticRequestError = {
66
+ requestId: RequestId;
67
+ url: string;
68
+ error: RequestError;
69
+ timings?: Timings;
70
+ };
71
+ /**
72
+ Message for the `got:response:redirect` diagnostic channel.
73
+
74
+ Emitted when following a redirect.
75
+ */
76
+ export type DiagnosticResponseRedirect = {
77
+ requestId: RequestId;
78
+ fromUrl: string;
79
+ toUrl: string;
80
+ statusCode: number;
81
+ };
82
+ export declare function generateRequestId(): RequestId;
83
+ export declare function publishRequestCreate(message: DiagnosticRequestCreate): void;
84
+ export declare function publishRequestStart(message: DiagnosticRequestStart): void;
85
+ export declare function publishResponseStart(message: DiagnosticResponseStart): void;
86
+ export declare function publishResponseEnd(message: DiagnosticResponseEnd): void;
87
+ export declare function publishRetry(message: DiagnosticRequestRetry): void;
88
+ export declare function publishError(message: DiagnosticRequestError): void;
89
+ export declare function publishRedirect(message: DiagnosticResponseRedirect): void;
@@ -0,0 +1,49 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import diagnosticsChannel from 'node:diagnostics_channel';
3
+ const channels = {
4
+ requestCreate: diagnosticsChannel.channel('got:request:create'),
5
+ requestStart: diagnosticsChannel.channel('got:request:start'),
6
+ responseStart: diagnosticsChannel.channel('got:response:start'),
7
+ responseEnd: diagnosticsChannel.channel('got:response:end'),
8
+ retry: diagnosticsChannel.channel('got:request:retry'),
9
+ error: diagnosticsChannel.channel('got:request:error'),
10
+ redirect: diagnosticsChannel.channel('got:response:redirect'),
11
+ };
12
+ export function generateRequestId() {
13
+ return randomUUID();
14
+ }
15
+ export function publishRequestCreate(message) {
16
+ if (channels.requestCreate.hasSubscribers) {
17
+ channels.requestCreate.publish(message);
18
+ }
19
+ }
20
+ export function publishRequestStart(message) {
21
+ if (channels.requestStart.hasSubscribers) {
22
+ channels.requestStart.publish(message);
23
+ }
24
+ }
25
+ export function publishResponseStart(message) {
26
+ if (channels.responseStart.hasSubscribers) {
27
+ channels.responseStart.publish(message);
28
+ }
29
+ }
30
+ export function publishResponseEnd(message) {
31
+ if (channels.responseEnd.hasSubscribers) {
32
+ channels.responseEnd.publish(message);
33
+ }
34
+ }
35
+ export function publishRetry(message) {
36
+ if (channels.retry.hasSubscribers) {
37
+ channels.retry.publish(message);
38
+ }
39
+ }
40
+ export function publishError(message) {
41
+ if (channels.error.hasSubscribers) {
42
+ channels.error.publish(message);
43
+ }
44
+ }
45
+ export function publishRedirect(message) {
46
+ if (channels.redirect.hasSubscribers) {
47
+ channels.redirect.publish(message);
48
+ }
49
+ }
@@ -0,0 +1,102 @@
1
+ import type { Timings } from './utils/timer.js';
2
+ import type Options from './options.js';
3
+ import type { TimeoutError as TimedOutTimeoutError } from './timed-out.js';
4
+ import type { PlainResponse, Response } from './response.js';
5
+ import type Request from './index.js';
6
+ type Error = NodeJS.ErrnoException;
7
+ /**
8
+ An error to be thrown when a request fails.
9
+ Contains a `code` property with error class code, like `ECONNREFUSED`.
10
+ */
11
+ export declare class RequestError<T = unknown> extends Error {
12
+ name: string;
13
+ code: string;
14
+ input?: string;
15
+ stack: string;
16
+ readonly options: Options;
17
+ readonly response?: Response<T>;
18
+ readonly request?: Request;
19
+ readonly timings?: Timings;
20
+ constructor(message: string, error: Partial<Error & {
21
+ code?: string;
22
+ }>, self: Request | Options);
23
+ }
24
+ /**
25
+ An error to be thrown when the server redirects you more than ten times.
26
+ Includes a `response` property.
27
+ */
28
+ export declare class MaxRedirectsError extends RequestError {
29
+ name: string;
30
+ code: string;
31
+ readonly response: Response;
32
+ readonly request: Request;
33
+ readonly timings: Timings;
34
+ constructor(request: Request);
35
+ }
36
+ /**
37
+ 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.
38
+ Includes a `response` property.
39
+ */
40
+ export declare class HTTPError<T = any> extends RequestError<T> {
41
+ name: string;
42
+ code: string;
43
+ readonly response: Response<T>;
44
+ readonly request: Request;
45
+ readonly timings: Timings;
46
+ constructor(response: PlainResponse);
47
+ }
48
+ /**
49
+ An error to be thrown when a cache method fails.
50
+ For example, if the database goes down or there's a filesystem error.
51
+ */
52
+ export declare class CacheError extends RequestError {
53
+ name: string;
54
+ readonly request: Request;
55
+ constructor(error: Error, request: Request);
56
+ }
57
+ /**
58
+ An error to be thrown when the request body is a stream and an error occurs while reading from that stream.
59
+ */
60
+ export declare class UploadError extends RequestError {
61
+ name: string;
62
+ readonly request: Request;
63
+ constructor(error: Error, request: Request);
64
+ }
65
+ /**
66
+ An error to be thrown when the request is aborted due to a timeout.
67
+ Includes an `event` and `timings` property.
68
+ */
69
+ export declare class TimeoutError extends RequestError {
70
+ name: string;
71
+ readonly request: Request;
72
+ readonly timings: Timings;
73
+ readonly event: string;
74
+ constructor(error: TimedOutTimeoutError, timings: Timings, request: Request);
75
+ }
76
+ /**
77
+ An error to be thrown when reading from response stream fails.
78
+ */
79
+ export declare class ReadError extends RequestError {
80
+ name: string;
81
+ readonly request: Request;
82
+ readonly response: Response;
83
+ readonly timings: Timings;
84
+ constructor(error: Error, request: Request);
85
+ }
86
+ /**
87
+ An error which always triggers a new retry when thrown.
88
+ */
89
+ export declare class RetryError extends RequestError {
90
+ name: string;
91
+ code: string;
92
+ constructor(request: Request);
93
+ }
94
+ /**
95
+ An error to be thrown when the request is aborted by AbortController.
96
+ */
97
+ export declare class AbortError extends RequestError {
98
+ name: string;
99
+ code: string;
100
+ constructor(request: Request);
101
+ }
102
+ export {};