@depup/got 15.0.1-depup.0 → 15.1.0-depup.10
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 -4
- package/changes.json +12 -4
- package/dist/source/as-promise/index.js +17 -3
- package/dist/source/core/index.d.ts +10 -1
- package/dist/source/core/index.js +400 -129
- package/dist/source/core/options.d.ts +38 -6
- package/dist/source/core/options.js +145 -18
- package/dist/source/core/parse-link-header.js +52 -2
- package/dist/source/core/utils/timer.js +19 -11
- package/dist/source/create.js +50 -7
- package/package.json +23 -15
package/README.md
CHANGED
|
@@ -13,16 +13,18 @@ npm install @depup/got
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [got](https://www.npmjs.com/package/got) @ 15.0
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [got](https://www.npmjs.com/package/got) @ 15.1.0 |
|
|
17
|
+
| Processed | 2026-07-21 |
|
|
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
|
-
|
|
|
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.8.0 |
|
|
26
28
|
|
|
27
29
|
---
|
|
28
30
|
|
package/changes.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bumped": {
|
|
3
|
+
"@sindresorhus/is": {
|
|
4
|
+
"from": "^8.0.0",
|
|
5
|
+
"to": "^8.1.0"
|
|
6
|
+
},
|
|
7
|
+
"cacheable-request": {
|
|
8
|
+
"from": "^13.0.18",
|
|
9
|
+
"to": "^13.0.19"
|
|
10
|
+
},
|
|
3
11
|
"type-fest": {
|
|
4
|
-
"from": "^5.
|
|
5
|
-
"to": "^5.
|
|
12
|
+
"from": "^5.6.0",
|
|
13
|
+
"to": "^5.8.0"
|
|
6
14
|
}
|
|
7
15
|
},
|
|
8
|
-
"timestamp": "2026-
|
|
9
|
-
"totalUpdated":
|
|
16
|
+
"timestamp": "2026-07-21T16:15:47.761Z",
|
|
17
|
+
"totalUpdated": 3
|
|
10
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,26 @@ 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 (updatedOptions.url) {
|
|
92
|
+
if (updatedOptions.url !== undefined) {
|
|
79
93
|
const nextUrl = reusesRequestOptions
|
|
80
94
|
? options.url
|
|
81
95
|
: applyUrlOverride(options, updatedOptions.url, updatedOptions);
|
|
@@ -99,16 +99,19 @@ 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;
|
|
112
115
|
private _incrementalDecode?;
|
|
113
116
|
private readonly _requestId;
|
|
114
117
|
private _requestInitialized;
|
|
@@ -123,6 +126,7 @@ export default class Request extends Duplex implements RequestEvents<Request> {
|
|
|
123
126
|
end?: boolean;
|
|
124
127
|
}): T;
|
|
125
128
|
unpipe<T extends NodeJS.WritableStream>(destination: T): this;
|
|
129
|
+
private _attachAbortListener;
|
|
126
130
|
private _shouldIncrementallyDecodeBody;
|
|
127
131
|
private _checkContentLengthMismatch;
|
|
128
132
|
private _finalizeBody;
|
|
@@ -139,7 +143,12 @@ export default class Request extends Duplex implements RequestEvents<Request> {
|
|
|
139
143
|
private _endWritableRequest;
|
|
140
144
|
private _stripCrossOriginState;
|
|
141
145
|
private _stripUnchangedCrossOriginState;
|
|
146
|
+
private get _methodCanHaveBody();
|
|
147
|
+
private _canWriteBody;
|
|
148
|
+
private _hasBodyForRedirect;
|
|
149
|
+
private _hasUnchangedBodyForRedirect;
|
|
142
150
|
private _dropBody;
|
|
151
|
+
private _destroyBody;
|
|
143
152
|
private readonly _onBodyError;
|
|
144
153
|
private _writeChunksToRequest;
|
|
145
154
|
private _prepareCache;
|