urllib 4.4.0 → 4.5.0-beta.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.
- package/README.md +0 -2
- package/dist/commonjs/FetchOpaqueInterceptor.js +1 -1
- package/dist/commonjs/FormData.d.ts +4 -0
- package/dist/commonjs/FormData.js +38 -0
- package/dist/commonjs/HttpAgent.d.ts +1 -1
- package/dist/commonjs/HttpAgent.js +1 -1
- package/dist/commonjs/HttpClient.d.ts +5 -1
- package/dist/commonjs/HttpClient.js +51 -54
- package/dist/commonjs/diagnosticsChannel.js +11 -4
- package/dist/commonjs/fetch.d.ts +2 -2
- package/dist/commonjs/fetch.js +9 -9
- package/dist/esm/FetchOpaqueInterceptor.js +1 -1
- package/dist/esm/FormData.d.ts +4 -0
- package/dist/esm/FormData.js +31 -0
- package/dist/esm/HttpAgent.d.ts +1 -1
- package/dist/esm/HttpAgent.js +1 -1
- package/dist/esm/HttpClient.d.ts +5 -1
- package/dist/esm/HttpClient.js +52 -55
- package/dist/esm/diagnosticsChannel.js +11 -4
- package/dist/esm/fetch.d.ts +2 -2
- package/dist/esm/fetch.js +4 -4
- package/dist/package.json +1 -1
- package/package.json +7 -5
- package/src/FetchOpaqueInterceptor.ts +1 -1
- package/src/FormData.ts +32 -0
- package/src/HttpAgent.ts +1 -1
- package/src/HttpClient.ts +65 -60
- package/src/diagnosticsChannel.ts +13 -3
- package/src/fetch.ts +7 -8
package/src/fetch.ts
CHANGED
@@ -8,21 +8,20 @@ import {
|
|
8
8
|
Agent,
|
9
9
|
getGlobalDispatcher,
|
10
10
|
Pool,
|
11
|
-
Dispatcher,
|
12
11
|
} from 'undici';
|
13
12
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
14
13
|
// @ts-ignore
|
15
14
|
import undiciSymbols from 'undici/lib/core/symbols.js';
|
16
15
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
17
16
|
// @ts-ignore
|
18
|
-
import
|
17
|
+
import { getResponseState } from 'undici/lib/web/fetch/response.js';
|
19
18
|
import {
|
20
19
|
channels,
|
21
20
|
ClientOptions,
|
22
21
|
PoolStat,
|
23
22
|
RequestDiagnosticsMessage,
|
24
23
|
ResponseDiagnosticsMessage,
|
25
|
-
|
24
|
+
UndiciTimingInfo,
|
26
25
|
} from './HttpClient.js';
|
27
26
|
import {
|
28
27
|
HttpAgent,
|
@@ -51,7 +50,7 @@ export type FetchDiagnosticsMessage = {
|
|
51
50
|
|
52
51
|
export type FetchResponseDiagnosticsMessage = {
|
53
52
|
fetch: FetchMeta;
|
54
|
-
timingInfo?:
|
53
|
+
timingInfo?: UndiciTimingInfo;
|
55
54
|
response?: Response;
|
56
55
|
error?: Error;
|
57
56
|
};
|
@@ -163,7 +162,7 @@ export class FetchFactory {
|
|
163
162
|
[symbols.kEnableRequestTiming]: !!(init.timing ?? true),
|
164
163
|
[symbols.kRequestTiming]: timing,
|
165
164
|
// [symbols.kRequestOriginalOpaque]: originalOpaque,
|
166
|
-
};
|
165
|
+
} as FetchOpaque;
|
167
166
|
const reqMeta: RequestMeta = {
|
168
167
|
requestId,
|
169
168
|
url: request.url,
|
@@ -236,8 +235,8 @@ export class FetchFactory {
|
|
236
235
|
throw e;
|
237
236
|
}
|
238
237
|
|
239
|
-
// get
|
240
|
-
const state =
|
238
|
+
// get undici internal response
|
239
|
+
const state = getResponseState(res!);
|
241
240
|
updateSocketInfo(socketInfo, internalOpaque /* , rawError */);
|
242
241
|
|
243
242
|
urllibResponse.headers = convertHeader(res!.headers);
|
@@ -250,7 +249,7 @@ export class FetchFactory {
|
|
250
249
|
|
251
250
|
channels.fetchResponse.publish({
|
252
251
|
fetch: fetchMeta,
|
253
|
-
timingInfo:
|
252
|
+
timingInfo: state.timingInfo,
|
254
253
|
response: res!,
|
255
254
|
} as FetchResponseDiagnosticsMessage);
|
256
255
|
channels.response.publish({
|