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.
- package/dist/source/as-promise/index.d.ts +2 -2
- package/dist/source/as-promise/index.js +105 -85
- package/dist/source/as-promise/types.d.ts +10 -23
- package/dist/source/as-promise/types.js +1 -17
- package/dist/source/core/calculate-retry-delay.js +1 -4
- package/dist/source/core/diagnostics-channel.js +12 -21
- package/dist/source/core/errors.d.ts +2 -1
- package/dist/source/core/errors.js +10 -13
- package/dist/source/core/index.d.ts +19 -7
- package/dist/source/core/index.js +748 -327
- package/dist/source/core/options.d.ts +117 -116
- package/dist/source/core/options.js +620 -309
- package/dist/source/core/response.d.ts +5 -3
- package/dist/source/core/response.js +26 -3
- package/dist/source/core/timed-out.d.ts +1 -1
- package/dist/source/core/timed-out.js +4 -4
- package/dist/source/core/utils/defer-to-connect.js +5 -17
- package/dist/source/core/utils/get-body-size.d.ts +1 -1
- package/dist/source/core/utils/get-body-size.js +3 -20
- package/dist/source/core/utils/is-unix-socket-url.d.ts +1 -1
- package/dist/source/core/utils/is-unix-socket-url.js +3 -4
- package/dist/source/core/utils/proxy-events.d.ts +1 -1
- package/dist/source/core/utils/proxy-events.js +3 -3
- package/dist/source/core/utils/strip-url-auth.d.ts +1 -0
- package/dist/source/core/utils/strip-url-auth.js +9 -0
- package/dist/source/core/utils/timer.js +5 -7
- package/dist/source/core/utils/unhandle.js +1 -2
- package/dist/source/create.js +83 -27
- package/dist/source/index.d.ts +2 -3
- package/dist/source/index.js +0 -4
- package/dist/source/types.d.ts +39 -70
- package/package.json +34 -38
- package/readme.md +2 -5
- package/dist/source/core/utils/is-form-data.d.ts +0 -7
- package/dist/source/core/utils/is-form-data.js +0 -4
- package/dist/source/core/utils/url-to-options.d.ts +0 -14
- package/dist/source/core/utils/url-to-options.js +0 -22
package/dist/source/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Buffer } from 'node:buffer';
|
|
2
1
|
import type { Spread } from 'type-fest';
|
|
3
|
-
import type {
|
|
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
|
|
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 |
|
|
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
|
|
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
|
|
64
|
-
export type
|
|
65
|
-
|
|
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 =
|
|
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' ?
|
|
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):
|
|
182
|
-
(url: string | URL, options?:
|
|
183
|
-
|
|
184
|
-
(url: string | URL, options?:
|
|
185
|
-
(url: string | URL, options?:
|
|
186
|
-
(url: string | URL, options?:
|
|
187
|
-
|
|
188
|
-
(url: string | URL, options?:
|
|
189
|
-
(url: string | URL, options?:
|
|
190
|
-
(url: string | URL, options?: OptionsOfTextResponseBodyOnly):
|
|
191
|
-
<T>(url: string | URL, options?: OptionsOfJSONResponseBodyOnly):
|
|
192
|
-
(url: string | URL, options?: OptionsOfBufferResponseBodyOnly):
|
|
193
|
-
(
|
|
194
|
-
(options:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
(options:
|
|
198
|
-
|
|
199
|
-
(options:
|
|
200
|
-
(options:
|
|
201
|
-
(options:
|
|
202
|
-
|
|
203
|
-
(options:
|
|
204
|
-
(options:
|
|
205
|
-
(
|
|
206
|
-
|
|
207
|
-
(options:
|
|
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?:
|
|
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": "
|
|
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": ">=
|
|
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
|
|
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.
|
|
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.
|
|
62
|
-
"lowercase-keys": "^
|
|
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.
|
|
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": "^
|
|
70
|
-
"@sinonjs/fake-timers": "^
|
|
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.
|
|
73
|
-
"@types/node": "^
|
|
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.
|
|
76
|
-
"@types/request": "^2.48.
|
|
77
|
-
"@types/sinon": "^
|
|
78
|
-
"@types/sinonjs__fake-timers": "^
|
|
79
|
-
"ava": "^
|
|
80
|
-
"axios": "^1.
|
|
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": "^
|
|
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": "^
|
|
89
|
-
"delay": "^
|
|
90
|
-
"expect-type": "^1.
|
|
91
|
-
"express": "^
|
|
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": "^
|
|
98
|
-
"p-event": "^
|
|
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.
|
|
102
|
-
"readable-stream": "^4.
|
|
97
|
+
"quick-lru": "^7.3.0",
|
|
98
|
+
"readable-stream": "^4.7.0",
|
|
103
99
|
"request": "^2.88.2",
|
|
104
|
-
"sinon": "^
|
|
100
|
+
"sinon": "^21.0.1",
|
|
105
101
|
"slow-stream": "0.0.4",
|
|
106
|
-
"tempy": "^3.
|
|
102
|
+
"tempy": "^3.2.0",
|
|
107
103
|
"then-busboy": "^5.2.1",
|
|
108
|
-
"tough-cookie": "^
|
|
109
|
-
"tsx": "^4.
|
|
110
|
-
"typescript": "^5.
|
|
111
|
-
"xo": "^
|
|
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
|
|
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.
|
|
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,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
|
-
}
|