got 14.4.6 → 14.4.8

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.
@@ -328,7 +328,7 @@ export default class Request extends Duplex {
328
328
  if (!error) {
329
329
  this._bodySize = this._uploadedSize;
330
330
  this.emit('uploadProgress', this.uploadProgress);
331
- this._request.emit('upload-complete');
331
+ this._request?.emit('upload-complete');
332
332
  }
333
333
  callback(error);
334
334
  });
@@ -1128,29 +1128,22 @@ export default class Options {
1128
1128
  followRedirect: boolean | ((response: PlainResponse) => boolean);
1129
1129
  retry: Partial<RetryOptions>;
1130
1130
  agent: Agents;
1131
- h2session: http2wrapper.ClientHttp2Session | undefined;
1131
+ h2session: ClientHttp2Session | undefined;
1132
1132
  decompress: boolean;
1133
1133
  prefixUrl: string | URL;
1134
- body: string | Readable | Buffer | Generator<unknown, any, any> | AsyncGenerator<unknown, any, any> | FormDataLike | undefined;
1134
+ body: string | Buffer | Readable | Generator | AsyncGenerator | FormDataLike | undefined;
1135
1135
  form: Record<string, any> | undefined;
1136
1136
  url: string | URL | undefined;
1137
1137
  cookieJar: PromiseCookieJar | ToughCookieJar | undefined;
1138
1138
  signal: AbortSignal | undefined;
1139
1139
  ignoreInvalidCookies: boolean;
1140
- searchParams: string | URLSearchParams | SearchParameters | undefined;
1141
- dnsLookup: {
1142
- (hostname: string, family: import("cacheable-lookup").IPFamily, callback: (error: NodeJS.ErrnoException | null, address: string, family: import("cacheable-lookup").IPFamily) => void): void;
1143
- (hostname: string, callback: (error: NodeJS.ErrnoException | null, address: string, family: import("cacheable-lookup").IPFamily) => void): void;
1144
- (hostname: string, options: import("cacheable-lookup").LookupOptions & {
1145
- all: true;
1146
- }, callback: (error: NodeJS.ErrnoException | null, result: ReadonlyArray<import("cacheable-lookup").EntryObject>) => void): void;
1147
- (hostname: string, options: import("cacheable-lookup").LookupOptions, callback: (error: NodeJS.ErrnoException | null, address: string, family: import("cacheable-lookup").IPFamily) => void): void;
1148
- } | undefined;
1149
- dnsCache: boolean | CacheableLookup | undefined;
1140
+ searchParams: string | SearchParameters | URLSearchParams | undefined;
1141
+ dnsLookup: CacheableLookup["lookup"] | undefined;
1142
+ dnsCache: CacheableLookup | boolean | undefined;
1150
1143
  context: Record<string, unknown>;
1151
1144
  hooks: Hooks;
1152
1145
  maxRedirects: number;
1153
- cache: string | boolean | StorageAdapter | undefined;
1146
+ cache: string | StorageAdapter | boolean | undefined;
1154
1147
  throwHttpErrors: boolean;
1155
1148
  http2: boolean;
1156
1149
  allowGetBody: boolean;
@@ -1174,22 +1167,22 @@ export default class Options {
1174
1167
  };
1175
1168
  createNativeRequestOptions(): {
1176
1169
  ALPNProtocols: string[] | undefined;
1177
- ca: string | Buffer | (string | Buffer)[] | undefined;
1178
- cert: string | Buffer | (string | Buffer)[] | undefined;
1179
- key: string | Buffer | (string | Buffer | import("tls").KeyObject)[] | undefined;
1170
+ ca: string | Buffer<ArrayBufferLike> | (string | Buffer<ArrayBufferLike>)[] | undefined;
1171
+ cert: string | Buffer<ArrayBufferLike> | (string | Buffer<ArrayBufferLike>)[] | undefined;
1172
+ key: string | Buffer<ArrayBufferLike> | (string | Buffer<ArrayBufferLike> | import("tls").KeyObject)[] | undefined;
1180
1173
  passphrase: string | undefined;
1181
1174
  pfx: PfxType;
1182
1175
  rejectUnauthorized: boolean | undefined;
1183
- checkServerIdentity: typeof checkServerIdentity | CheckServerIdentityFunction;
1176
+ checkServerIdentity: CheckServerIdentityFunction | typeof checkServerIdentity;
1184
1177
  ciphers: string | undefined;
1185
1178
  honorCipherOrder: boolean | undefined;
1186
1179
  minVersion: import("tls").SecureVersion | undefined;
1187
1180
  maxVersion: import("tls").SecureVersion | undefined;
1188
1181
  sigalgs: string | undefined;
1189
1182
  sessionTimeout: number | undefined;
1190
- dhparam: string | Buffer | undefined;
1183
+ dhparam: string | Buffer<ArrayBufferLike> | undefined;
1191
1184
  ecdhCurve: string | undefined;
1192
- crl: string | Buffer | (string | Buffer)[] | undefined;
1185
+ crl: string | Buffer<ArrayBufferLike> | (string | Buffer<ArrayBufferLike>)[] | undefined;
1193
1186
  lookup: {
1194
1187
  (hostname: string, family: import("cacheable-lookup").IPFamily, callback: (error: NodeJS.ErrnoException | null, address: string, family: import("cacheable-lookup").IPFamily) => void): void;
1195
1188
  (hostname: string, callback: (error: NodeJS.ErrnoException | null, address: string, family: import("cacheable-lookup").IPFamily) => void): void;
@@ -1219,6 +1212,7 @@ export default class Options {
1219
1212
  path?: string | null | undefined;
1220
1213
  port?: number | string | null | undefined;
1221
1214
  protocol?: string | null | undefined;
1215
+ setDefaultHeaders?: boolean | undefined;
1222
1216
  signal?: AbortSignal | undefined;
1223
1217
  socketPath?: string | undefined;
1224
1218
  uniqueHeaders?: Array<string | string[]> | undefined;
@@ -1227,6 +1221,7 @@ export default class Options {
1227
1221
  servername: string;
1228
1222
  protocols: string[];
1229
1223
  }) => string | undefined) | undefined;
1224
+ allowPartialTrustChain?: boolean | undefined;
1230
1225
  clientCertEngine?: string | undefined;
1231
1226
  privateKeyEngine?: string | undefined;
1232
1227
  privateKeyIdentifier?: string | undefined;
@@ -359,7 +359,10 @@ export default class Options {
359
359
  return;
360
360
  }
361
361
  if (options instanceof Options) {
362
- for (const init of options._init) {
362
+ // Create a copy of the _init array to avoid infinite loop
363
+ // when merging an Options instance with itself
364
+ const initArray = [...options._init];
365
+ for (const init of initArray) {
363
366
  this.merge(init);
364
367
  }
365
368
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "got",
3
- "version": "14.4.6",
3
+ "version": "14.4.8",
4
4
  "description": "Human-friendly and powerful HTTP request library for Node.js",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/got",
package/readme.md CHANGED
@@ -164,7 +164,7 @@ By default, Got will retry on failure. To disable this option, set [`options.ret
164
164
  | Cookies (out-of-the-box) | :heavy_check_mark: | :x: | :x: | :x: | :x: |
165
165
  | Follows redirects | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
166
166
  | Retries on failure | :heavy_check_mark: | :x: | :heavy_check_mark: | :x: | :heavy_check_mark: |
167
- | Progress events | :heavy_check_mark: | :x: | :heavy_check_mark:\*\*\* | Browser only | :heavy_check_mark: |
167
+ | Progress events | :heavy_check_mark: | :x: | :heavy_check_mark: | Browser only | :heavy_check_mark: |
168
168
  | Handles gzip/deflate | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
169
169
  | Advanced timeouts | :heavy_check_mark: | :x: | :x: | :x: | :x: |
170
170
  | Timings | :heavy_check_mark: | :x: | :x: | :x: | :x: |
@@ -187,7 +187,6 @@ By default, Got will retry on failure. To disable this option, set [`options.ret
187
187
 
188
188
  \* It's almost API compatible with the browser `fetch` API.\
189
189
  \*\* Need to switch the protocol manually. Doesn't accept PUSH streams and doesn't reuse HTTP/2 sessions.\
190
- \*\*\* Currently, only `DownloadProgress` event is supported, `UploadProgress` event is not supported.\
191
190
  ¹ Requires Node.js 15.10.0 or above.\
192
191
  :sparkle: Almost-stable feature, but the API may change. Don't hesitate to try it out!\
193
192
  :grey_question: Feature in early stage of development. Very experimental.