@depup/got 15.0.1-depup.1 → 16.0.0-depup.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/README.md +6 -5
- package/changes.json +10 -6
- package/dist/source/as-promise/index.js +28 -4
- package/dist/source/core/calculate-retry-delay.js +1 -1
- package/dist/source/core/index.d.ts +12 -1
- package/dist/source/core/index.js +572 -189
- package/dist/source/core/options.d.ts +72 -47
- package/dist/source/core/options.js +309 -82
- package/dist/source/core/parse-link-header.js +52 -2
- package/dist/source/core/timed-out.js +1 -1
- package/dist/source/core/utils/dns-cache.d.ts +56 -0
- package/dist/source/core/utils/dns-cache.js +522 -0
- package/dist/source/core/utils/http2-client.d.ts +83 -0
- package/dist/source/core/utils/http2-client.js +1248 -0
- package/dist/source/core/utils/is-unix-socket-url.d.ts +0 -1
- package/dist/source/core/utils/is-unix-socket-url.js +1 -1
- package/dist/source/core/utils/timer.js +19 -11
- package/dist/source/create.js +75 -22
- package/dist/source/types.d.ts +5 -6
- package/package.json +23 -22
- package/readme.md +4 -5
package/README.md
CHANGED
|
@@ -13,17 +13,18 @@ npm install @depup/got
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [got](https://www.npmjs.com/package/got) @
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [got](https://www.npmjs.com/package/got) @ 16.0.0 |
|
|
17
|
+
| Processed | 2026-08-31 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
|
-
| Deps updated |
|
|
19
|
+
| Deps updated | 3 |
|
|
20
20
|
|
|
21
21
|
## Dependency Changes
|
|
22
22
|
|
|
23
23
|
| Dependency | From | To |
|
|
24
24
|
|------------|------|-----|
|
|
25
|
-
| @sindresorhus/is | ^
|
|
26
|
-
|
|
|
25
|
+
| @sindresorhus/is | ^8.0.0 | ^8.1.0 |
|
|
26
|
+
| cacheable-request | ^13.0.18 | ^13.0.19 |
|
|
27
|
+
| type-fest | ^5.6.0 | ^5.9.0 |
|
|
27
28
|
|
|
28
29
|
---
|
|
29
30
|
|
package/changes.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bumped": {
|
|
3
3
|
"@sindresorhus/is": {
|
|
4
|
-
"from": "^
|
|
5
|
-
"to": "^8.
|
|
4
|
+
"from": "^8.0.0",
|
|
5
|
+
"to": "^8.1.0"
|
|
6
|
+
},
|
|
7
|
+
"cacheable-request": {
|
|
8
|
+
"from": "^13.0.18",
|
|
9
|
+
"to": "^13.0.19"
|
|
6
10
|
},
|
|
7
11
|
"type-fest": {
|
|
8
|
-
"from": "^5.
|
|
9
|
-
"to": "^5.
|
|
12
|
+
"from": "^5.6.0",
|
|
13
|
+
"to": "^5.9.0"
|
|
10
14
|
}
|
|
11
15
|
},
|
|
12
|
-
"timestamp": "2026-
|
|
13
|
-
"totalUpdated":
|
|
16
|
+
"timestamp": "2026-08-31T00:36:02.619Z",
|
|
17
|
+
"totalUpdated": 3
|
|
14
18
|
}
|
|
@@ -4,7 +4,7 @@ import { HTTPError, RetryError, } from '../core/errors.js';
|
|
|
4
4
|
import Request, { normalizeError } from '../core/index.js';
|
|
5
5
|
import { decodeUint8Array, isUtf8Encoding, parseBody, isResponseOk, ParseError, } from '../core/response.js';
|
|
6
6
|
import proxyEvents from '../core/utils/proxy-events.js';
|
|
7
|
-
import { applyUrlOverride, isSameOrigin, snapshotCrossOriginState, } from '../core/options.js';
|
|
7
|
+
import { applyUrlOverride, assertUrlHasSameOriginAsPrefixUrlIfNeeded, getUrlPrefixBoundary, hasUrlOrPrefixUrlBoundaryChanged, isSameOrigin, snapshotCrossOriginState, } from '../core/options.js';
|
|
8
8
|
const compressedEncodings = new Set(['gzip', 'deflate', 'br', 'zstd']);
|
|
9
9
|
const proxiedRequestEvents = [
|
|
10
10
|
'request',
|
|
@@ -56,6 +56,7 @@ export default function asPromise(firstRequest) {
|
|
|
56
56
|
const hooks = options.hooks.afterResponse;
|
|
57
57
|
for (const [index, hook] of hooks.entries()) {
|
|
58
58
|
const previousUrl = options.url ? new URL(options.url) : undefined;
|
|
59
|
+
const previousBoundary = getUrlPrefixBoundary(options);
|
|
59
60
|
const previousState = previousUrl ? snapshotCrossOriginState(options) : undefined;
|
|
60
61
|
const requestOptions = response.request.options;
|
|
61
62
|
const responseSnapshot = response;
|
|
@@ -69,13 +70,36 @@ export default function asPromise(firstRequest) {
|
|
|
69
70
|
: (Object.hasOwn(updatedOptions, 'body') && updatedOptions.body !== undefined)
|
|
70
71
|
|| (Object.hasOwn(updatedOptions, 'json') && updatedOptions.json !== undefined)
|
|
71
72
|
|| (Object.hasOwn(updatedOptions, 'form') && updatedOptions.form !== undefined);
|
|
73
|
+
const clearsCookieJar = Object.hasOwn(updatedOptions, 'cookieJar') && updatedOptions.cookieJar === undefined;
|
|
72
74
|
if (hasExplicitBody && !reusesRequestOptions) {
|
|
73
75
|
options.clearBody();
|
|
74
76
|
}
|
|
77
|
+
if (!reusesRequestOptions && clearsCookieJar) {
|
|
78
|
+
options.cookieJar = undefined;
|
|
79
|
+
}
|
|
75
80
|
if (!reusesRequestOptions) {
|
|
76
|
-
|
|
81
|
+
const { url, ...updatedOptionsWithoutUrl } = updatedOptions;
|
|
82
|
+
options.merge(updatedOptionsWithoutUrl);
|
|
83
|
+
options.syncCookieHeaderAfterMerge(previousState, updatedOptionsWithoutUrl.headers);
|
|
84
|
+
}
|
|
85
|
+
options.clearUnchangedCookieHeader(previousState, reusesRequestOptions ? changedState : undefined);
|
|
86
|
+
const currentUrl = options.url;
|
|
87
|
+
if (previousUrl
|
|
88
|
+
&& currentUrl instanceof URL
|
|
89
|
+
&& hasUrlOrPrefixUrlBoundaryChanged(options, currentUrl, previousBoundary)) {
|
|
90
|
+
assertUrlHasSameOriginAsPrefixUrlIfNeeded(options, currentUrl);
|
|
77
91
|
}
|
|
78
|
-
if (
|
|
92
|
+
if (!reusesRequestOptions
|
|
93
|
+
&& updatedOptions.url === undefined
|
|
94
|
+
&& previousUrl
|
|
95
|
+
&& currentUrl instanceof URL
|
|
96
|
+
&& !isSameOrigin(previousUrl, currentUrl)) {
|
|
97
|
+
options.stripSensitiveHeaders(previousUrl, currentUrl, updatedOptions);
|
|
98
|
+
if (!hasExplicitBody) {
|
|
99
|
+
options.clearBody();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (updatedOptions.url !== undefined) {
|
|
79
103
|
const nextUrl = reusesRequestOptions
|
|
80
104
|
? options.url
|
|
81
105
|
: applyUrlOverride(options, updatedOptions.url, updatedOptions);
|
|
@@ -137,7 +161,7 @@ export default function asPromise(firstRequest) {
|
|
|
137
161
|
if (error instanceof HTTPError && !options.throwHttpErrors) {
|
|
138
162
|
const { response } = error;
|
|
139
163
|
request.destroy();
|
|
140
|
-
resolve(
|
|
164
|
+
resolve(options.resolveBodyOnly ? response.body : response);
|
|
141
165
|
return;
|
|
142
166
|
}
|
|
143
167
|
reject(error);
|
|
@@ -13,7 +13,7 @@ const calculateRetryDelay = ({ attemptCount, retryOptions, error, retryAfter, co
|
|
|
13
13
|
}
|
|
14
14
|
if (error.response) {
|
|
15
15
|
if (retryAfter) {
|
|
16
|
-
// In this case `computedValue` is `options.request
|
|
16
|
+
// In this case `computedValue` is `retryOptions.maxRetryAfter ?? options.timeout.request ?? Infinity`
|
|
17
17
|
return retryAfter > computedValue ? 0 : retryAfter;
|
|
18
18
|
}
|
|
19
19
|
if (error.response.statusCode === 413) {
|
|
@@ -99,16 +99,20 @@ export default class Request extends Duplex implements RequestEvents<Request> {
|
|
|
99
99
|
private _request?;
|
|
100
100
|
private _responseSize?;
|
|
101
101
|
private _bodySize?;
|
|
102
|
+
private _nativeFormDataBody?;
|
|
102
103
|
private _unproxyEvents?;
|
|
103
104
|
private _triggerRead;
|
|
104
105
|
private readonly _jobs;
|
|
105
106
|
private _cancelTimeouts?;
|
|
106
|
-
private
|
|
107
|
+
private _abortListenerDisposer?;
|
|
107
108
|
private _flushed;
|
|
108
109
|
private _aborted;
|
|
109
110
|
private _expectedContentLength?;
|
|
110
111
|
private _compressedBytesCount?;
|
|
111
112
|
private _skipRequestEndInFinal;
|
|
113
|
+
private _hasWrittenBody;
|
|
114
|
+
private _hasWritableBody;
|
|
115
|
+
private _discardBodyWrites;
|
|
112
116
|
private _incrementalDecode?;
|
|
113
117
|
private readonly _requestId;
|
|
114
118
|
private _requestInitialized;
|
|
@@ -123,6 +127,8 @@ export default class Request extends Duplex implements RequestEvents<Request> {
|
|
|
123
127
|
end?: boolean;
|
|
124
128
|
}): T;
|
|
125
129
|
unpipe<T extends NodeJS.WritableStream>(destination: T): this;
|
|
130
|
+
private _attachAbortListener;
|
|
131
|
+
private _destroyInFlightAlpnSocket;
|
|
126
132
|
private _shouldIncrementallyDecodeBody;
|
|
127
133
|
private _checkContentLengthMismatch;
|
|
128
134
|
private _finalizeBody;
|
|
@@ -139,7 +145,12 @@ export default class Request extends Duplex implements RequestEvents<Request> {
|
|
|
139
145
|
private _endWritableRequest;
|
|
140
146
|
private _stripCrossOriginState;
|
|
141
147
|
private _stripUnchangedCrossOriginState;
|
|
148
|
+
private get _methodCanHaveBody();
|
|
149
|
+
private _canWriteBody;
|
|
150
|
+
private _hasBodyForRedirect;
|
|
151
|
+
private _hasUnchangedBodyForRedirect;
|
|
142
152
|
private _dropBody;
|
|
153
|
+
private _destroyBody;
|
|
143
154
|
private readonly _onBodyError;
|
|
144
155
|
private _writeChunksToRequest;
|
|
145
156
|
private _prepareCache;
|