rekwest 3.2.0 → 3.3.2

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/index.js CHANGED
@@ -7,15 +7,15 @@ var _exportNames = {
7
7
  exports.constants = void 0;
8
8
  exports.default = rekwest;
9
9
 
10
- var _http = _interopRequireDefault(require("http"));
10
+ var _nodeHttp = _interopRequireDefault(require("node:http"));
11
11
 
12
- var _http2 = _interopRequireWildcard(require("http2"));
12
+ var _nodeHttp2 = _interopRequireWildcard(require("node:http2"));
13
13
 
14
- exports.constants = _http2.constants;
14
+ exports.constants = _nodeHttp2.constants;
15
15
 
16
- var _https = _interopRequireDefault(require("https"));
16
+ var _nodeHttps = _interopRequireDefault(require("node:https"));
17
17
 
18
- var _promises = require("timers/promises");
18
+ var _promises = require("node:timers/promises");
19
19
 
20
20
  var _ackn = require("./ackn.js");
21
21
 
@@ -44,17 +44,17 @@ Object.keys(_errors).forEach(function (key) {
44
44
  exports[key] = _errors[key];
45
45
  });
46
46
 
47
- var _helpers = require("./helpers.js");
47
+ var _mediatypes = require("./mediatypes.js");
48
+
49
+ var _utils = require("./utils.js");
48
50
 
49
- Object.keys(_helpers).forEach(function (key) {
51
+ Object.keys(_utils).forEach(function (key) {
50
52
  if (key === "default" || key === "__esModule") return;
51
53
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
52
- if (key in exports && exports[key] === _helpers[key]) return;
53
- exports[key] = _helpers[key];
54
+ if (key in exports && exports[key] === _utils[key]) return;
55
+ exports[key] = _utils[key];
54
56
  });
55
57
 
56
- var _mediatypes = require("./mediatypes.js");
57
-
58
58
  var _file = require("./file.js");
59
59
 
60
60
  Object.keys(_file).forEach(function (key) {
@@ -92,7 +92,7 @@ const {
92
92
  HTTP_STATUS_SEE_OTHER,
93
93
  HTTP_STATUS_SERVICE_UNAVAILABLE,
94
94
  HTTP_STATUS_TOO_MANY_REQUESTS
95
- } = _http2.default.constants;
95
+ } = _nodeHttp2.default.constants;
96
96
  const maxRetryAfter = Symbol('maxRetryAfter');
97
97
 
98
98
  const maxRetryAfterError = (interval, options) => new _errors.RequestError(`Maximum '${HTTP2_HEADER_RETRY_AFTER}' limit exceeded: ${interval} ms.`, options);
@@ -120,10 +120,15 @@ let defaults = {
120
120
  };
121
121
 
122
122
  async function rekwest(url, options = {}) {
123
- url = options.url = new URL(url);
123
+ ({
124
+ url
125
+ } = (0, _utils.revise)({
126
+ options,
127
+ url
128
+ }));
124
129
 
125
130
  if (!options.redirected) {
126
- options = (0, _helpers.merge)(rekwest.defaults, options);
131
+ options = (0, _utils.merge)(rekwest.defaults, options);
127
132
  }
128
133
 
129
134
  if (options.body && [HTTP2_METHOD_GET, HTTP2_METHOD_HEAD].includes(options.method)) {
@@ -140,7 +145,7 @@ async function rekwest(url, options = {}) {
140
145
  ['alpnProtocol', 'createConnection', 'h2', 'protocol'].forEach(it => Reflect.deleteProperty(options, it));
141
146
  }
142
147
 
143
- options = (0, _helpers.preflight)(options);
148
+ options = (0, _utils.preflight)(options);
144
149
  const {
145
150
  cookies,
146
151
  digest,
@@ -148,29 +153,26 @@ async function rekwest(url, options = {}) {
148
153
  h2,
149
154
  redirect,
150
155
  redirected,
151
- thenable,
152
- url: {
153
- protocol
154
- }
156
+ thenable
155
157
  } = options;
156
158
  const {
157
159
  request
158
- } = protocol === 'http:' ? _http.default : _https.default;
160
+ } = url.protocol === 'http:' ? _nodeHttp.default : _nodeHttps.default;
159
161
  let {
160
162
  body
161
163
  } = options;
162
164
  const promise = new Promise((resolve, reject) => {
163
165
  let client, req;
164
- body &&= (0, _helpers.transform)(body, options);
166
+ body &&= (0, _utils.transform)(body, options);
165
167
 
166
168
  if (h2) {
167
- client = _http2.default.connect(url.origin, options);
169
+ client = _nodeHttp2.default.connect(url.origin, options);
168
170
  req = client.request(options.headers, options);
169
171
  } else {
170
172
  req = request(url, options);
171
173
  }
172
174
 
173
- (0, _helpers.affix)(client, req, options);
175
+ (0, _utils.affix)(client, req, options);
174
176
  req.once('error', reject);
175
177
  req.once('frameError', reject);
176
178
  req.once('goaway', reject);
@@ -184,7 +186,7 @@ async function rekwest(url, options = {}) {
184
186
  res.once('error', reject);
185
187
  }
186
188
 
187
- (0, _helpers.admix)(res, headers, options);
189
+ (0, _utils.admix)(res, headers, options);
188
190
 
189
191
  if (cookies !== false && res.headers[HTTP2_HEADER_SET_COOKIE]) {
190
192
  if (_cookies.Cookies.jar.has(url.origin)) {
@@ -202,11 +204,11 @@ async function rekwest(url, options = {}) {
202
204
  });
203
205
 
204
206
  if (follow && /^3\d{2}$/.test(res.statusCode) && res.headers[HTTP2_HEADER_LOCATION]) {
205
- if (redirect === _helpers.redirects.error) {
207
+ if (redirect === _utils.redirects.error) {
206
208
  return res.emit('error', new _errors.RequestError(`Unexpected redirect, redirect mode is set to '${redirect}'.`));
207
209
  }
208
210
 
209
- if (redirect === _helpers.redirects.follow) {
211
+ if (redirect === _utils.redirects.follow) {
210
212
  options.url = new URL(res.headers[HTTP2_HEADER_LOCATION], url).href;
211
213
 
212
214
  if (res.statusCode !== HTTP_STATUS_SEE_OTHER && body === Object(body) && body.pipe?.constructor === Function) {
@@ -229,7 +231,7 @@ async function rekwest(url, options = {}) {
229
231
 
230
232
  if (interval > options.maxRetryAfter) {
231
233
  return res.emit('error', maxRetryAfterError(interval, {
232
- cause: (0, _helpers.mixin)(res, options)
234
+ cause: (0, _utils.mixin)(res, options)
233
235
  }));
234
236
  }
235
237
 
@@ -241,12 +243,12 @@ async function rekwest(url, options = {}) {
241
243
  }
242
244
 
243
245
  if (res.statusCode >= HTTP_STATUS_BAD_REQUEST) {
244
- return reject((0, _helpers.mixin)(res, options));
246
+ return reject((0, _utils.mixin)(res, options));
245
247
  }
246
248
 
247
- resolve((0, _helpers.mixin)(res, options));
249
+ resolve((0, _utils.mixin)(res, options));
248
250
  });
249
- (0, _helpers.dispatch)(req, { ...options,
251
+ (0, _utils.dispatch)(req, { ...options,
250
252
  body
251
253
  });
252
254
  });
@@ -302,35 +304,37 @@ async function rekwest(url, options = {}) {
302
304
 
303
305
  Reflect.defineProperty(rekwest, 'stream', {
304
306
  enumerable: true,
305
- value: function (url, options = {}) {
306
- options = (0, _helpers.preflight)({
307
- url,
308
- ...(0, _helpers.merge)(rekwest.defaults, {
307
+
308
+ value(url, options = {}) {
309
+ ({
310
+ url
311
+ } = (0, _utils.revise)({
312
+ options,
313
+ url
314
+ }));
315
+ options = (0, _utils.preflight)({ ...(0, _utils.merge)(rekwest.defaults, {
309
316
  headers: {
310
317
  [HTTP2_HEADER_CONTENT_TYPE]: _mediatypes.APPLICATION_OCTET_STREAM
311
318
  }
312
319
  }, options),
313
- redirect: _helpers.redirects.manual
320
+ redirect: _utils.redirects.manual
314
321
  });
315
322
  const {
316
- h2,
317
- url: {
318
- protocol
319
- }
323
+ h2
320
324
  } = options;
321
325
  const {
322
326
  request
323
- } = protocol === 'http:' ? _http.default : _https.default;
327
+ } = url.protocol === 'http:' ? _nodeHttp.default : _nodeHttps.default;
324
328
  let client, req;
325
329
 
326
330
  if (h2) {
327
- client = _http2.default.connect(url.origin, options);
331
+ client = _nodeHttp2.default.connect(url.origin, options);
328
332
  req = client.request(options.headers, options);
329
333
  } else {
330
- req = request(options.url, options);
334
+ req = request(url, options);
331
335
  }
332
336
 
333
- (0, _helpers.affix)(client, req, options);
337
+ (0, _utils.affix)(client, req, options);
334
338
  req.once('response', res => {
335
339
  let headers;
336
340
 
@@ -339,10 +343,11 @@ Reflect.defineProperty(rekwest, 'stream', {
339
343
  res = req;
340
344
  }
341
345
 
342
- (0, _helpers.admix)(res, headers, options);
346
+ (0, _utils.admix)(res, headers, options);
343
347
  });
344
348
  return req;
345
349
  }
350
+
346
351
  });
347
352
  Reflect.defineProperty(rekwest, 'defaults', {
348
353
  enumerable: true,
@@ -352,7 +357,7 @@ Reflect.defineProperty(rekwest, 'defaults', {
352
357
  },
353
358
 
354
359
  set(value) {
355
- defaults = (0, _helpers.merge)(defaults, value);
360
+ defaults = (0, _utils.merge)(defaults, value);
356
361
  }
357
362
 
358
363
  });
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.redirects = exports.preflight = exports.mixin = exports.merge = exports.dispatch = exports.decompress = exports.compress = exports.affix = exports.admix = void 0;
4
+ exports.revise = exports.redirects = exports.preflight = exports.mixin = exports.merge = exports.dispatch = exports.decompress = exports.compress = exports.collate = exports.affix = exports.admix = void 0;
5
5
  exports.tap = tap;
6
6
  exports.transform = void 0;
7
7
 
8
- var _buffer = require("buffer");
8
+ var _nodeBuffer = require("node:buffer");
9
9
 
10
- var _http = _interopRequireDefault(require("http2"));
10
+ var _nodeHttp = _interopRequireDefault(require("node:http2"));
11
11
 
12
- var _stream = require("stream");
12
+ var _nodeStream = require("node:stream");
13
13
 
14
- var _util = require("util");
14
+ var _nodeUtil = require("node:util");
15
15
 
16
- var _zlib = _interopRequireDefault(require("zlib"));
16
+ var _nodeZlib = _interopRequireDefault(require("node:zlib"));
17
17
 
18
18
  var _cookies = require("./cookies.js");
19
19
 
@@ -41,13 +41,13 @@ const {
41
41
  HTTP2_HEADER_STATUS,
42
42
  HTTP2_METHOD_GET,
43
43
  HTTP2_METHOD_HEAD
44
- } = _http.default.constants;
45
- const brotliCompress = (0, _util.promisify)(_zlib.default.brotliCompress);
46
- const brotliDecompress = (0, _util.promisify)(_zlib.default.brotliDecompress);
47
- const gzip = (0, _util.promisify)(_zlib.default.gzip);
48
- const gunzip = (0, _util.promisify)(_zlib.default.gunzip);
49
- const deflate = (0, _util.promisify)(_zlib.default.deflate);
50
- const inflate = (0, _util.promisify)(_zlib.default.inflate);
44
+ } = _nodeHttp.default.constants;
45
+ const brotliCompress = (0, _nodeUtil.promisify)(_nodeZlib.default.brotliCompress);
46
+ const brotliDecompress = (0, _nodeUtil.promisify)(_nodeZlib.default.brotliDecompress);
47
+ const gzip = (0, _nodeUtil.promisify)(_nodeZlib.default.gzip);
48
+ const gunzip = (0, _nodeUtil.promisify)(_nodeZlib.default.gunzip);
49
+ const deflate = (0, _nodeUtil.promisify)(_nodeZlib.default.deflate);
50
+ const inflate = (0, _nodeUtil.promisify)(_nodeZlib.default.inflate);
51
51
 
52
52
  const admix = (res, headers, options) => {
53
53
  const {
@@ -94,14 +94,22 @@ const affix = (client, req, options) => {
94
94
 
95
95
  exports.affix = affix;
96
96
 
97
+ const collate = (entity, primordial) => {
98
+ if (entity?.constructor !== primordial) {
99
+ throw new TypeError('Illegal invocation');
100
+ }
101
+ };
102
+
103
+ exports.collate = collate;
104
+
97
105
  const compress = (buf, encoding, {
98
106
  async = false
99
107
  } = {}) => {
100
108
  encoding &&= encoding.match(/(?<encoding>\bbr\b|\bdeflate\b|\bgzip\b)/i)?.groups.encoding.toLowerCase();
101
109
  const compressor = {
102
- br: async ? brotliCompress : _zlib.default.brotliCompressSync,
103
- deflate: async ? deflate : _zlib.default.deflateSync,
104
- gzip: async ? gzip : _zlib.default.gzipSync
110
+ br: async ? brotliCompress : _nodeZlib.default.brotliCompressSync,
111
+ deflate: async ? deflate : _nodeZlib.default.deflateSync,
112
+ gzip: async ? gzip : _nodeZlib.default.gzipSync
105
113
  }[encoding];
106
114
  return compressor?.(buf) ?? (async ? Promise.resolve(buf) : buf);
107
115
  };
@@ -113,9 +121,9 @@ const decompress = (buf, encoding, {
113
121
  } = {}) => {
114
122
  encoding &&= encoding.match(/(?<encoding>\bbr\b|\bdeflate\b|\bgzip\b)/i)?.groups.encoding.toLowerCase();
115
123
  const decompressor = {
116
- br: async ? brotliDecompress : _zlib.default.brotliDecompressSync,
117
- deflate: async ? inflate : _zlib.default.inflateSync,
118
- gzip: async ? gunzip : _zlib.default.gunzipSync
124
+ br: async ? brotliDecompress : _nodeZlib.default.brotliDecompressSync,
125
+ deflate: async ? inflate : _nodeZlib.default.inflateSync,
126
+ gzip: async ? gunzip : _nodeZlib.default.gunzipSync
119
127
  }[encoding];
120
128
  return decompressor?.(buf) ?? (async ? Promise.resolve(buf) : buf);
121
129
  };
@@ -128,14 +136,14 @@ const dispatch = (req, {
128
136
  }) => {
129
137
  if (body === Object(body) && !Buffer.isBuffer(body)) {
130
138
  if (body.pipe?.constructor !== Function && (Reflect.has(body, Symbol.asyncIterator) || Reflect.has(body, Symbol.iterator))) {
131
- body = _stream.Readable.from(body);
139
+ body = _nodeStream.Readable.from(body);
132
140
  }
133
141
 
134
142
  const compressor = {
135
- br: _zlib.default.createBrotliCompress,
136
- deflate: _zlib.default.createDeflate,
137
- gzip: _zlib.default.createGzip
138
- }[headers[HTTP2_HEADER_CONTENT_ENCODING]] ?? _stream.PassThrough;
143
+ br: _nodeZlib.default.createBrotliCompress,
144
+ deflate: _nodeZlib.default.createDeflate,
145
+ gzip: _nodeZlib.default.createGzip
146
+ }[headers[HTTP2_HEADER_CONTENT_ENCODING]] ?? _nodeStream.PassThrough;
139
147
  body.pipe(compressor()).pipe(req);
140
148
  } else {
141
149
  req.end(body);
@@ -179,31 +187,39 @@ const mixin = (res, {
179
187
  Object.defineProperties(res, {
180
188
  arrayBuffer: {
181
189
  enumerable: true,
182
- value: function () {
190
+ value: async function () {
191
+ collate(this, res?.constructor);
183
192
  parse &&= false;
184
- return this.body().then(({
193
+ const {
185
194
  buffer,
186
195
  byteLength,
187
196
  byteOffset
188
- }) => buffer.slice(byteOffset, byteOffset + byteLength));
197
+ } = await this.body();
198
+ return buffer.slice(byteOffset, byteOffset + byteLength);
189
199
  }
190
200
  },
191
201
  blob: {
192
202
  enumerable: true,
193
- value: function () {
194
- return this.arrayBuffer().then(res => new _buffer.Blob([res]));
203
+ value: async function () {
204
+ collate(this, res?.constructor);
205
+ const val = await this.arrayBuffer();
206
+ return new _nodeBuffer.Blob([val]);
195
207
  }
196
208
  },
197
209
  json: {
198
210
  enumerable: true,
199
- value: function () {
200
- return this.text().then(res => JSON.parse(res));
211
+ value: async function () {
212
+ collate(this, res?.constructor);
213
+ const val = await this.text();
214
+ return JSON.parse(val);
201
215
  }
202
216
  },
203
217
  text: {
204
218
  enumerable: true,
205
- value: function () {
206
- return this.blob().then(blob => blob.text());
219
+ value: async function () {
220
+ collate(this, res?.constructor);
221
+ const blob = await this.blob();
222
+ return blob.text();
207
223
  }
208
224
  }
209
225
  });
@@ -213,8 +229,10 @@ const mixin = (res, {
213
229
  body: {
214
230
  enumerable: true,
215
231
  value: async function () {
232
+ collate(this, res?.constructor);
233
+
216
234
  if (this.bodyUsed) {
217
- throw new TypeError('Response stream already read.');
235
+ throw new TypeError('Response stream already read');
218
236
  }
219
237
 
220
238
  let spool = [];
@@ -252,9 +270,11 @@ const mixin = (res, {
252
270
  },
253
271
  bodyUsed: {
254
272
  enumerable: true,
255
- get: function () {
273
+
274
+ get() {
256
275
  return this.readableEnded;
257
276
  }
277
+
258
278
  }
259
279
  });
260
280
  };
@@ -262,13 +282,13 @@ const mixin = (res, {
262
282
  exports.mixin = mixin;
263
283
 
264
284
  const preflight = options => {
265
- const url = options.url = new URL(options.url);
266
285
  const {
267
286
  cookies,
268
287
  h2 = false,
269
- method = HTTP2_METHOD_GET,
270
288
  headers,
271
- redirected
289
+ method = HTTP2_METHOD_GET,
290
+ redirected,
291
+ url
272
292
  } = options;
273
293
 
274
294
  if (h2) {
@@ -333,6 +353,22 @@ const redirects = {
333
353
  };
334
354
  exports.redirects = redirects;
335
355
 
356
+ const revise = ({
357
+ url,
358
+ options
359
+ }) => {
360
+ if (options.trimTrailingSlashes) {
361
+ url = `${url}`.replace(/(?<!:)\/+/gi, '/');
362
+ }
363
+
364
+ url = new URL(url);
365
+ return Object.assign(options, {
366
+ url
367
+ });
368
+ };
369
+
370
+ exports.revise = revise;
371
+
336
372
  async function* tap(value) {
337
373
  if (Reflect.has(value, Symbol.asyncIterator)) {
338
374
  yield* value;
@@ -346,9 +382,9 @@ async function* tap(value) {
346
382
  const transform = (body, options) => {
347
383
  let headers = {};
348
384
 
349
- if (_util.types.isAnyArrayBuffer(body) && !Buffer.isBuffer(body)) {
385
+ if (_nodeUtil.types.isAnyArrayBuffer(body) && !Buffer.isBuffer(body)) {
350
386
  body = Buffer.from(body);
351
- } else if (_util.types.isArrayBufferView(body) && !Buffer.isBuffer(body)) {
387
+ } else if (_nodeUtil.types.isArrayBufferView(body) && !Buffer.isBuffer(body)) {
352
388
  body = Buffer.from(body.buffer, body.byteOffset, body.byteLength);
353
389
  }
354
390
 
@@ -357,7 +393,7 @@ const transform = (body, options) => {
357
393
  [HTTP2_HEADER_CONTENT_LENGTH]: body.size,
358
394
  [HTTP2_HEADER_CONTENT_TYPE]: body.type || _mediatypes.APPLICATION_OCTET_STREAM
359
395
  };
360
- body = body.stream?.() ?? _stream.Readable.from(tap(body));
396
+ body = body.stream?.() ?? _nodeStream.Readable.from(tap(body));
361
397
  } else if (_formdata.FormData.alike(body)) {
362
398
  body = _formdata.FormData.actuate(body);
363
399
  headers = {
package/package.json CHANGED
@@ -8,14 +8,14 @@
8
8
  "url": "https://github.com/bricss/rekwest/issues"
9
9
  },
10
10
  "devDependencies": {
11
- "@babel/cli": "^7.17.6",
12
- "@babel/core": "^7.17.9",
13
- "@babel/eslint-parser": "^7.17.0",
14
- "@babel/preset-env": "^7.16.11",
15
- "c8": "^7.11.2",
16
- "eslint": "^8.14.0",
11
+ "@babel/cli": "^7.18.10",
12
+ "@babel/core": "^7.18.10",
13
+ "@babel/eslint-parser": "^7.18.9",
14
+ "@babel/preset-env": "^7.18.10",
15
+ "c8": "^7.12.0",
16
+ "eslint": "^8.21.0",
17
17
  "eslint-config-ultra-refined": "^2.5.0",
18
- "mocha": "^9.2.2"
18
+ "mocha": "^10.0.0"
19
19
  },
20
20
  "description": "The robust request library that humanity deserves 🌐",
21
21
  "engines": {
@@ -32,6 +32,8 @@
32
32
  "homepage": "https://github.com/bricss/rekwest#readme",
33
33
  "keywords": [
34
34
  "backoff",
35
+ "compression",
36
+ "cookie",
35
37
  "fetch",
36
38
  "fetch-alike",
37
39
  "formdata",
@@ -42,6 +44,7 @@
42
44
  "http2",
43
45
  "multipart",
44
46
  "request",
47
+ "redirect",
45
48
  "retry"
46
49
  ],
47
50
  "license": "MIT",
@@ -62,5 +65,5 @@
62
65
  "test:bail": "mocha --bail",
63
66
  "test:cover": "c8 --include=src --reporter=lcov --reporter=text npm test"
64
67
  },
65
- "version": "3.2.0"
68
+ "version": "3.3.2"
66
69
  }
package/src/ackn.mjs CHANGED
@@ -1,33 +1,33 @@
1
- import { connect } from 'tls';
2
-
3
- export const ackn = (options) => new Promise((resolve, reject) => {
4
- const { url } = options;
5
- const socket = connect({
6
- ...options,
7
- ALPNProtocols: [
8
- 'h2',
9
- 'http/1.1',
10
- ],
11
- host: url.hostname,
12
- port: parseInt(url.port) || 443,
13
- servername: url.hostname,
14
- }, () => {
15
- socket.off('error', reject);
16
- socket.off('timeout', reject);
17
-
18
- const { alpnProtocol } = socket;
19
-
20
- resolve({
21
- ...options,
22
- alpnProtocol,
23
- createConnection() {
24
- return socket;
25
- },
26
- h2: /h2c?/.test(alpnProtocol),
27
- protocol: url.protocol,
28
- });
29
- });
30
-
31
- socket.on('error', reject);
32
- socket.on('timeout', reject);
33
- });
1
+ import { connect } from 'node:tls';
2
+
3
+ export const ackn = (options) => new Promise((resolve, reject) => {
4
+ const { url } = options;
5
+ const socket = connect({
6
+ ...options,
7
+ ALPNProtocols: [
8
+ 'h2',
9
+ 'http/1.1',
10
+ ],
11
+ host: url.hostname,
12
+ port: parseInt(url.port) || 443,
13
+ servername: url.hostname,
14
+ }, () => {
15
+ socket.off('error', reject);
16
+ socket.off('timeout', reject);
17
+
18
+ const { alpnProtocol } = socket;
19
+
20
+ resolve({
21
+ ...options,
22
+ alpnProtocol,
23
+ createConnection() {
24
+ return socket;
25
+ },
26
+ h2: /h2c?/.test(alpnProtocol),
27
+ protocol: url.protocol,
28
+ });
29
+ });
30
+
31
+ socket.on('error', reject);
32
+ socket.on('timeout', reject);
33
+ });
package/src/cookies.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ import { collate } from './utils.mjs';
2
+
1
3
  export class Cookies extends URLSearchParams {
2
4
 
3
5
  static jar = new Map();
@@ -18,6 +20,8 @@ export class Cookies extends URLSearchParams {
18
20
  }
19
21
 
20
22
  toString() {
23
+ collate(this, Cookies);
24
+
21
25
  return super.toString().split('&').join('; ').trim();
22
26
  }
23
27
 
package/src/file.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { Blob } from 'buffer';
1
+ import { Blob } from 'node:buffer';
2
2
 
3
- export { Blob } from 'buffer';
3
+ export { Blob } from 'node:buffer';
4
4
 
5
5
  export class File extends Blob {
6
6