got 14.6.6 → 15.0.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 (37) hide show
  1. package/dist/source/as-promise/index.d.ts +2 -2
  2. package/dist/source/as-promise/index.js +105 -85
  3. package/dist/source/as-promise/types.d.ts +10 -23
  4. package/dist/source/as-promise/types.js +1 -17
  5. package/dist/source/core/calculate-retry-delay.js +1 -4
  6. package/dist/source/core/diagnostics-channel.js +12 -21
  7. package/dist/source/core/errors.d.ts +2 -1
  8. package/dist/source/core/errors.js +10 -13
  9. package/dist/source/core/index.d.ts +19 -7
  10. package/dist/source/core/index.js +748 -327
  11. package/dist/source/core/options.d.ts +117 -116
  12. package/dist/source/core/options.js +620 -309
  13. package/dist/source/core/response.d.ts +5 -3
  14. package/dist/source/core/response.js +26 -3
  15. package/dist/source/core/timed-out.d.ts +1 -1
  16. package/dist/source/core/timed-out.js +4 -4
  17. package/dist/source/core/utils/defer-to-connect.js +5 -17
  18. package/dist/source/core/utils/get-body-size.d.ts +1 -1
  19. package/dist/source/core/utils/get-body-size.js +3 -20
  20. package/dist/source/core/utils/is-unix-socket-url.d.ts +1 -1
  21. package/dist/source/core/utils/is-unix-socket-url.js +3 -4
  22. package/dist/source/core/utils/proxy-events.d.ts +1 -1
  23. package/dist/source/core/utils/proxy-events.js +3 -3
  24. package/dist/source/core/utils/strip-url-auth.d.ts +1 -0
  25. package/dist/source/core/utils/strip-url-auth.js +9 -0
  26. package/dist/source/core/utils/timer.js +5 -7
  27. package/dist/source/core/utils/unhandle.js +1 -2
  28. package/dist/source/create.js +83 -27
  29. package/dist/source/index.d.ts +2 -3
  30. package/dist/source/index.js +0 -4
  31. package/dist/source/types.d.ts +39 -70
  32. package/package.json +34 -38
  33. package/readme.md +2 -5
  34. package/dist/source/core/utils/is-form-data.d.ts +0 -7
  35. package/dist/source/core/utils/is-form-data.js +0 -4
  36. package/dist/source/core/utils/url-to-options.d.ts +0 -14
  37. package/dist/source/core/utils/url-to-options.js +0 -22
@@ -1,6 +1,5 @@
1
- import type { Buffer } from 'node:buffer';
2
1
  import type { Spread } from 'type-fest';
3
- import type { CancelableRequest } from './as-promise/types.js';
2
+ import type { RequestPromise } from './as-promise/types.js';
4
3
  import type { Response } from './core/response.js';
5
4
  import type Options from './core/options.js';
6
5
  import { type PaginationOptions, type OptionsInit } from './core/options.js';
@@ -18,7 +17,7 @@ export type InstanceDefaults = {
18
17
  /**
19
18
  An array of functions. You execute them directly by calling `got()`.
20
19
  They are some sort of "global hooks" - these functions are called first.
21
- The last handler (*it's hidden*) is either `asPromise` or `asStream`, depending on the `options.isStream` property.
20
+ The last handler (*it's hidden*) is either `asPromise` or `asStream`, depending on whether `got()` or `got.stream()` was called.
22
21
 
23
22
  @default []
24
23
  */
@@ -34,7 +33,7 @@ export type InstanceDefaults = {
34
33
  /**
35
34
  A Request object returned by calling Got, or any of the Got HTTP alias request functions.
36
35
  */
37
- export type GotReturn = Request | CancelableRequest;
36
+ export type GotReturn = Request | RequestPromise;
38
37
  /**
39
38
  A function to handle options and returns a Request object.
40
39
  It acts sort of like a "global hook", and will be called before any actual request is made.
@@ -47,7 +46,7 @@ export type ExtendOptions = {
47
46
  /**
48
47
  An array of functions. You execute them directly by calling `got()`.
49
48
  They are some sort of "global hooks" - these functions are called first.
50
- The last handler (*it's hidden*) is either `asPromise` or `asStream`, depending on the `options.isStream` property.
49
+ The last handler (*it's hidden*) is either `asPromise` or `asStream`, depending on whether `got()` or `got.stream()` was called.
51
50
 
52
51
  @default []
53
52
  */
@@ -59,12 +58,10 @@ export type ExtendOptions = {
59
58
  @default false
60
59
  */
61
60
  mutableDefaults?: boolean;
62
- } & OptionsInit;
63
- export type StrictOptions = Except<OptionsInit, 'isStream' | 'responseType' | 'resolveBodyOnly'>;
64
- export type StreamOptions = Merge<OptionsInit, {
65
- isStream?: true;
66
- }>;
67
- export type OptionsWithPagination<T = unknown, R = unknown> = Merge<OptionsInit, {
61
+ } & Except<OptionsInit, 'url'>;
62
+ export type StreamOptions = Except<OptionsInit, 'url'>;
63
+ export type StrictOptions = Except<StreamOptions, 'responseType' | 'resolveBodyOnly'>;
64
+ export type OptionsWithPagination<T = unknown, R = unknown> = Merge<StreamOptions, {
68
65
  pagination?: PaginationOptions<T, R>;
69
66
  }>;
70
67
  /**
@@ -124,107 +121,81 @@ export type GotPaginate = {
124
121
  all: (<T, R = unknown>(url: string | URL, options?: OptionsWithPagination<T, R>) => Promise<T[]>) & (<T, R = unknown>(options?: OptionsWithPagination<T, R>) => Promise<T[]>);
125
122
  };
126
123
  export type OptionsOfTextResponseBody = Merge<StrictOptions, {
127
- isStream?: false;
128
124
  responseType?: 'text';
129
125
  }>;
130
126
  export type OptionsOfTextResponseBodyOnly = Merge<StrictOptions, {
131
- isStream?: false;
132
127
  resolveBodyOnly: true;
133
128
  responseType?: 'text';
134
129
  }>;
135
130
  export type OptionsOfTextResponseBodyWrapped = Merge<StrictOptions, {
136
- isStream?: false;
137
131
  resolveBodyOnly: false;
138
132
  responseType?: 'text';
139
133
  }>;
140
134
  export type OptionsOfJSONResponseBody = Merge<StrictOptions, {
141
- isStream?: false;
142
135
  responseType?: 'json';
143
136
  }>;
144
137
  export type OptionsOfJSONResponseBodyOnly = Merge<StrictOptions, {
145
- isStream?: false;
146
138
  resolveBodyOnly: true;
147
139
  responseType?: 'json';
148
140
  }>;
149
141
  export type OptionsOfJSONResponseBodyWrapped = Merge<StrictOptions, {
150
- isStream?: false;
151
142
  resolveBodyOnly: false;
152
143
  responseType?: 'json';
153
144
  }>;
154
145
  export type OptionsOfBufferResponseBody = Merge<StrictOptions, {
155
- isStream?: false;
156
146
  responseType?: 'buffer';
157
147
  }>;
158
148
  export type OptionsOfBufferResponseBodyOnly = Merge<StrictOptions, {
159
- isStream?: false;
160
149
  resolveBodyOnly: true;
161
150
  responseType?: 'buffer';
162
151
  }>;
163
152
  export type OptionsOfBufferResponseBodyWrapped = Merge<StrictOptions, {
164
- isStream?: false;
165
153
  resolveBodyOnly: false;
166
154
  responseType?: 'buffer';
167
155
  }>;
168
- export type OptionsOfUnknownResponseBody = Merge<StrictOptions, {
169
- isStream?: false;
170
- }>;
156
+ export type OptionsOfUnknownResponseBody = StrictOptions;
171
157
  export type OptionsOfUnknownResponseBodyOnly = Merge<StrictOptions, {
172
- isStream?: false;
173
158
  resolveBodyOnly: true;
174
159
  }>;
175
160
  export type OptionsOfUnknownResponseBodyWrapped = Merge<StrictOptions, {
176
- isStream?: false;
177
161
  resolveBodyOnly: false;
178
162
  }>;
179
- type DefaultResponseBodyType<U extends ExtendOptions> = U['responseType'] extends 'json' ? unknown : U['responseType'] extends 'buffer' ? Buffer : string;
163
+ type DefaultResponseBodyType<U extends ExtendOptions> = U['responseType'] extends 'json' ? unknown : U['responseType'] extends 'buffer' ? Uint8Array<ArrayBuffer> : string;
164
+ type GotResponseResult<U extends ExtendOptions, BodyType> = U['resolveBodyOnly'] extends true ? RequestPromise<BodyType> : RequestPromise<Response<BodyType>>;
180
165
  export type GotRequestFunction<U extends ExtendOptions = Record<string, unknown>> = {
181
- (url: string | URL): U['resolveBodyOnly'] extends true ? CancelableRequest<DefaultResponseBodyType<U>> : CancelableRequest<Response<DefaultResponseBodyType<U>>>;
182
- (url: string | URL, options?: OptionsOfTextResponseBody): U['resolveBodyOnly'] extends true ? CancelableRequest<string> : CancelableRequest<Response<string>>;
183
- <T>(url: string | URL, options?: OptionsOfJSONResponseBody): U['resolveBodyOnly'] extends true ? CancelableRequest<T> : CancelableRequest<Response<T>>;
184
- (url: string | URL, options?: OptionsOfBufferResponseBody): U['resolveBodyOnly'] extends true ? CancelableRequest<Buffer> : CancelableRequest<Response<Buffer>>;
185
- (url: string | URL, options?: OptionsOfUnknownResponseBody): U['resolveBodyOnly'] extends true ? CancelableRequest : CancelableRequest<Response>;
186
- (url: string | URL, options?: OptionsOfTextResponseBodyWrapped): CancelableRequest<Response<string>>;
187
- <T>(url: string | URL, options?: OptionsOfJSONResponseBodyWrapped): CancelableRequest<Response<T>>;
188
- (url: string | URL, options?: OptionsOfBufferResponseBodyWrapped): CancelableRequest<Response<Buffer>>;
189
- (url: string | URL, options?: OptionsOfUnknownResponseBodyWrapped): CancelableRequest<Response>;
190
- (url: string | URL, options?: OptionsOfTextResponseBodyOnly): CancelableRequest<string>;
191
- <T>(url: string | URL, options?: OptionsOfJSONResponseBodyOnly): CancelableRequest<T>;
192
- (url: string | URL, options?: OptionsOfBufferResponseBodyOnly): CancelableRequest<Buffer>;
193
- (url: string | URL, options?: OptionsOfUnknownResponseBodyOnly): CancelableRequest;
194
- (options: {
195
- url: string | URL;
196
- }): U['resolveBodyOnly'] extends true ? CancelableRequest<DefaultResponseBodyType<U>> : CancelableRequest<Response<DefaultResponseBodyType<U>>>;
197
- (options: OptionsOfTextResponseBody): U['resolveBodyOnly'] extends true ? CancelableRequest<string> : CancelableRequest<Response<string>>;
198
- <T>(options: OptionsOfJSONResponseBody): U['resolveBodyOnly'] extends true ? CancelableRequest<T> : CancelableRequest<Response<T>>;
199
- (options: OptionsOfBufferResponseBody): U['resolveBodyOnly'] extends true ? CancelableRequest<Buffer> : CancelableRequest<Response<Buffer>>;
200
- (options: OptionsOfUnknownResponseBody): U['resolveBodyOnly'] extends true ? CancelableRequest : CancelableRequest<Response>;
201
- (options: OptionsOfTextResponseBodyWrapped): CancelableRequest<Response<string>>;
202
- <T>(options: OptionsOfJSONResponseBodyWrapped): CancelableRequest<Response<T>>;
203
- (options: OptionsOfBufferResponseBodyWrapped): CancelableRequest<Response<Buffer>>;
204
- (options: OptionsOfUnknownResponseBodyWrapped): CancelableRequest<Response>;
205
- (options: OptionsOfTextResponseBodyOnly): CancelableRequest<string>;
206
- <T>(options: OptionsOfJSONResponseBodyOnly): CancelableRequest<T>;
207
- (options: OptionsOfBufferResponseBodyOnly): CancelableRequest<Buffer>;
208
- (options: OptionsOfUnknownResponseBodyOnly): CancelableRequest;
209
- (url: string | URL, options?: Merge<OptionsInit, {
210
- isStream: true;
211
- }>): Request;
212
- (options: Merge<OptionsInit, {
213
- isStream: true;
214
- }>): Request;
215
- (url: string | URL, options?: OptionsInit): CancelableRequest | Request;
216
- (options: OptionsInit): CancelableRequest | Request;
217
- (url: undefined, options: undefined, defaults: Options): CancelableRequest | Request;
166
+ (url: string | URL, options?: OptionsOfUnknownResponseBody): GotResponseResult<U, DefaultResponseBodyType<U>>;
167
+ (url: string | URL, options?: OptionsOfUnknownResponseBodyWrapped): RequestPromise<Response<DefaultResponseBodyType<U>>>;
168
+ (url: string | URL, options?: OptionsOfUnknownResponseBodyOnly): RequestPromise<DefaultResponseBodyType<U>>;
169
+ (url: string | URL, options?: OptionsOfTextResponseBody): GotResponseResult<U, string>;
170
+ <T>(url: string | URL, options?: OptionsOfJSONResponseBody): GotResponseResult<U, T>;
171
+ (url: string | URL, options?: OptionsOfBufferResponseBody): GotResponseResult<U, Uint8Array<ArrayBuffer>>;
172
+ (url: string | URL, options?: OptionsOfTextResponseBodyWrapped): RequestPromise<Response<string>>;
173
+ <T>(url: string | URL, options?: OptionsOfJSONResponseBodyWrapped): RequestPromise<Response<T>>;
174
+ (url: string | URL, options?: OptionsOfBufferResponseBodyWrapped): RequestPromise<Response<Uint8Array<ArrayBuffer>>>;
175
+ (url: string | URL, options?: OptionsOfTextResponseBodyOnly): RequestPromise<string>;
176
+ <T>(url: string | URL, options?: OptionsOfJSONResponseBodyOnly): RequestPromise<T>;
177
+ (url: string | URL, options?: OptionsOfBufferResponseBodyOnly): RequestPromise<Uint8Array<ArrayBuffer>>;
178
+ (options: OptionsOfUnknownResponseBody): GotResponseResult<U, DefaultResponseBodyType<U>>;
179
+ (options: OptionsOfUnknownResponseBodyWrapped): RequestPromise<Response<DefaultResponseBodyType<U>>>;
180
+ (options: OptionsOfUnknownResponseBodyOnly): RequestPromise<DefaultResponseBodyType<U>>;
181
+ (options: OptionsOfTextResponseBody): GotResponseResult<U, string>;
182
+ <T>(options: OptionsOfJSONResponseBody): GotResponseResult<U, T>;
183
+ (options: OptionsOfBufferResponseBody): GotResponseResult<U, Uint8Array<ArrayBuffer>>;
184
+ (options: OptionsOfTextResponseBodyWrapped): RequestPromise<Response<string>>;
185
+ <T>(options: OptionsOfJSONResponseBodyWrapped): RequestPromise<Response<T>>;
186
+ (options: OptionsOfBufferResponseBodyWrapped): RequestPromise<Response<Uint8Array<ArrayBuffer>>>;
187
+ (options: OptionsOfTextResponseBodyOnly): RequestPromise<string>;
188
+ <T>(options: OptionsOfJSONResponseBodyOnly): RequestPromise<T>;
189
+ (options: OptionsOfBufferResponseBodyOnly): RequestPromise<Uint8Array<ArrayBuffer>>;
190
+ (url: string | URL, options?: StreamOptions): RequestPromise;
191
+ (options: StreamOptions): RequestPromise;
192
+ (url: undefined, options: undefined, defaults: Options): RequestPromise;
218
193
  };
219
194
  /**
220
195
  All available HTTP request methods provided by Got.
221
196
  */
222
197
  export type HTTPAlias = 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete';
223
- type GotStreamFunction = ((url?: string | URL, options?: Merge<OptionsInit, {
224
- isStream?: true;
225
- }>) => Request) & ((options?: Merge<OptionsInit, {
226
- isStream?: true;
227
- }>) => Request);
198
+ type GotStreamFunction = ((url?: string | URL, options?: StreamOptions) => Request) & ((options?: StreamOptions) => Request);
228
199
  /**
229
200
  An instance of `got.stream()`.
230
201
  */
@@ -234,8 +205,6 @@ An instance of `got`.
234
205
  */
235
206
  export type Got<GotOptions extends ExtendOptions = ExtendOptions> = {
236
207
  /**
237
- Sets `options.isStream` to `true`.
238
-
239
208
  Returns a [duplex stream](https://nodejs.org/api/stream.html#stream_class_stream_duplex) with additional events:
240
209
  - request
241
210
  - response
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "got",
3
- "version": "14.6.6",
3
+ "version": "15.0.1",
4
4
  "description": "Human-friendly and powerful HTTP request library for Node.js",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/got",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "sideEffects": false,
14
14
  "engines": {
15
- "node": ">=20"
15
+ "node": ">=22"
16
16
  },
17
17
  "scripts": {
18
18
  "test": "xo && tsc --noEmit && NODE_OPTIONS='--import=tsx/esm' ava",
@@ -51,64 +51,60 @@
51
51
  "ky"
52
52
  ],
53
53
  "dependencies": {
54
- "@sindresorhus/is": "^7.0.1",
54
+ "@sindresorhus/is": "^7.2.0",
55
55
  "byte-counter": "^0.1.0",
56
56
  "cacheable-lookup": "^7.0.0",
57
- "cacheable-request": "^13.0.12",
57
+ "cacheable-request": "^13.0.18",
58
+ "chunk-data": "^0.1.0",
58
59
  "decompress-response": "^10.0.0",
59
- "form-data-encoder": "^4.0.2",
60
60
  "http2-wrapper": "^2.2.1",
61
- "keyv": "^5.5.3",
62
- "lowercase-keys": "^3.0.0",
63
- "p-cancelable": "^4.0.1",
61
+ "keyv": "^5.6.0",
62
+ "lowercase-keys": "^4.0.1",
64
63
  "responselike": "^4.0.2",
65
- "type-fest": "^4.26.1"
64
+ "type-fest": "^5.4.4",
65
+ "uint8array-extras": "^1.5.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@hapi/bourne": "^3.0.0",
69
- "@sindresorhus/tsconfig": "^6.0.0",
70
- "@sinonjs/fake-timers": "^11.2.2",
69
+ "@sindresorhus/tsconfig": "^8.1.0",
70
+ "@sinonjs/fake-timers": "^15.1.0",
71
71
  "@types/benchmark": "^2.1.5",
72
- "@types/express": "^5.0.0",
73
- "@types/node": "^22.7.5",
72
+ "@types/express": "^5.0.6",
73
+ "@types/node": "^25.3.0",
74
74
  "@types/pem": "^1.14.4",
75
- "@types/readable-stream": "^4.0.14",
76
- "@types/request": "^2.48.12",
77
- "@types/sinon": "^17.0.2",
78
- "@types/sinonjs__fake-timers": "^8.1.5",
79
- "ava": "^5.3.1",
80
- "axios": "^1.7.7",
75
+ "@types/readable-stream": "^4.0.23",
76
+ "@types/request": "^2.48.13",
77
+ "@types/sinon": "^21.0.0",
78
+ "@types/sinonjs__fake-timers": "^15.0.1",
79
+ "ava": "^6.4.1",
80
+ "axios": "^1.13.5",
81
81
  "benchmark": "^2.1.4",
82
82
  "bluebird": "^3.7.2",
83
- "body-parser": "^1.20.3",
83
+ "body-parser": "^2.2.2",
84
84
  "c8": "^10.1.3",
85
- "chunk-data": "^0.1.0",
86
85
  "create-cert": "^1.0.6",
87
86
  "create-test-server": "^3.0.1",
88
- "del-cli": "^6.0.0",
89
- "delay": "^6.0.0",
90
- "expect-type": "^1.0.0",
91
- "express": "^4.21.1",
92
- "form-data": "^4.0.0",
93
- "formdata-node": "^6.0.3",
87
+ "del-cli": "^7.0.0",
88
+ "delay": "^7.0.0",
89
+ "expect-type": "^1.3.0",
90
+ "express": "^5.2.1",
94
91
  "get-stream": "^9.0.1",
95
- "nock": "^13.5.5",
96
92
  "node-fetch": "^3.3.2",
97
- "np": "^10.0.5",
98
- "p-event": "^6.0.1",
93
+ "np": "^11.0.2",
94
+ "p-event": "^7.1.0",
99
95
  "pem": "^1.14.8",
100
96
  "pify": "^6.1.0",
101
- "quick-lru": "^7.2.0",
102
- "readable-stream": "^4.4.2",
97
+ "quick-lru": "^7.3.0",
98
+ "readable-stream": "^4.7.0",
103
99
  "request": "^2.88.2",
104
- "sinon": "^19.0.2",
100
+ "sinon": "^21.0.1",
105
101
  "slow-stream": "0.0.4",
106
- "tempy": "^3.1.0",
102
+ "tempy": "^3.2.0",
107
103
  "then-busboy": "^5.2.1",
108
- "tough-cookie": "^4.1.4",
109
- "tsx": "^4.19.1",
110
- "typescript": "^5.6.3",
111
- "xo": "^0.56.0"
104
+ "tough-cookie": "^6.0.0",
105
+ "tsx": "^4.21.0",
106
+ "typescript": "^5.9.3",
107
+ "xo": "^1.2.3"
112
108
  },
113
109
  "ava": {
114
110
  "files": [
package/readme.md CHANGED
@@ -176,7 +176,7 @@ By default, Got will retry on failure. To disable this option, set [`options.ret
176
176
  | Promise API | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
177
177
  | Stream API | :heavy_check_mark: | Node.js only | :x: | :x: | :heavy_check_mark: |
178
178
  | Pagination API | :heavy_check_mark: | :x: | :x: | :x: | :x: |
179
- | Request cancelation | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
179
+ | Request aborting | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
180
180
  | RFC compliant caching | :heavy_check_mark: | :x: | :x: | :x: | :x: |
181
181
  | Cookies (out-of-the-box) | :heavy_check_mark: | :x: | :x: | :x: | :x: |
182
182
  | Follows redirects | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
@@ -254,13 +254,11 @@ By default, Got will retry on failure. To disable this option, set [`options.ret
254
254
  [s3]: https://www.npmjs.com/package/superagent
255
255
 
256
256
  <!-- COVERAGE -->
257
- [gc]: https://img.shields.io/coveralls/github/sindresorhus/got?color=0b9062&label
258
257
  [kc]: https://img.shields.io/codecov/c/github/sindresorhus/ky?color=0b9062&label
259
258
  [nc]: https://img.shields.io/coveralls/github/bitinn/node-fetch?color=0b9062&label
260
259
  [ac]: https://img.shields.io/coveralls/github/mzabriskie/axios?color=0b9062&label
261
260
  [sc]: https://img.shields.io/codecov/c/github/visionmedia/superagent?color=0b9062&label
262
261
 
263
- [g4]: https://coveralls.io/github/sindresorhus/got
264
262
  [k4]: https://codecov.io/gh/sindresorhus/ky
265
263
  [n4]: https://coveralls.io/github/bitinn/node-fetch
266
264
  [a4]: https://coveralls.io/github/mzabriskie/axios
@@ -342,7 +340,6 @@ By default, Got will retry on failure. To disable this option, set [`options.ret
342
340
  [k10]: https://github.com/sindresorhus/ky
343
341
  [n10]: https://github.com/node-fetch/node-fetch
344
342
  [a10]: https://github.com/axios/axios
345
- [s10]: https://github.com/visionmedia/superagent
346
343
 
347
344
  <!-- LAST COMMIT -->
348
345
  [glc]: https://img.shields.io/github/last-commit/sindresorhus/got?color=gray&label
@@ -359,7 +356,7 @@ By default, Got will retry on failure. To disable this option, set [`options.ret
359
356
 
360
357
  [Click here][InstallSizeOfTheDependencies] to see the install size of the Got dependencies.
361
358
 
362
- [InstallSizeOfTheDependencies]: https://packagephobia.com/result?p=@sindresorhus/is@7.0.0,@szmarczak/http-timer@5.0.1,cacheable-lookup@7.0.0,cacheable-request@12.0.1,decompress-response@6.0.0,form-data-encoder@4.0.2,http2-wrapper@2.2.1,lowercase-keys@3.0.0,p-cancelable@4.0.1,responselike@3.0.0,type-fest@4.19.0
359
+ [InstallSizeOfTheDependencies]: https://packagephobia.com/result?p=@sindresorhus/is@7.2.0,byte-counter@0.1.0,cacheable-lookup@7.0.0,cacheable-request@13.0.18,chunk-data@0.1.0,decompress-response@10.0.0,http2-wrapper@2.2.1,keyv@5.6.0,lowercase-keys@4.0.1,responselike@4.0.2,type-fest@5.4.4
363
360
 
364
361
  ## Maintainers
365
362
 
@@ -1,7 +0,0 @@
1
- import type { Readable } from 'node:stream';
2
- type FormData = {
3
- getBoundary: () => string;
4
- getLength: (callback: (error: Error | null, length: number) => void) => void;
5
- } & Readable;
6
- export default function isFormData(body: unknown): body is FormData;
7
- export {};
@@ -1,4 +0,0 @@
1
- import is from '@sindresorhus/is';
2
- export default function isFormData(body) {
3
- return is.nodeStream(body) && is.function(body.getBoundary);
4
- }
@@ -1,14 +0,0 @@
1
- import type { UrlWithStringQuery } from 'node:url';
2
- export type LegacyUrlOptions = {
3
- protocol: string;
4
- hostname: string;
5
- host: string;
6
- hash: string | null;
7
- search: string | null;
8
- pathname: string;
9
- href: string;
10
- path: string;
11
- port?: number;
12
- auth?: string;
13
- };
14
- export default function urlToOptions(url: URL | UrlWithStringQuery): LegacyUrlOptions;
@@ -1,22 +0,0 @@
1
- import is from '@sindresorhus/is';
2
- export default function urlToOptions(url) {
3
- // Cast to URL
4
- url = url;
5
- const options = {
6
- protocol: url.protocol,
7
- hostname: is.string(url.hostname) && url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname,
8
- host: url.host,
9
- hash: url.hash,
10
- search: url.search,
11
- pathname: url.pathname,
12
- href: url.href,
13
- path: `${url.pathname || ''}${url.search || ''}`,
14
- };
15
- if (is.string(url.port) && url.port.length > 0) {
16
- options.port = Number(url.port);
17
- }
18
- if (url.username || url.password) {
19
- options.auth = `${url.username || ''}:${url.password || ''}`;
20
- }
21
- return options;
22
- }