rekwest 7.2.2 → 7.2.3
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/cookies.cjs +4 -4
- package/dist/formdata.cjs +8 -9
- package/package.json +1 -1
- package/src/cookies.js +4 -4
- package/src/formdata.js +8 -9
package/dist/cookies.cjs
CHANGED
|
@@ -30,7 +30,7 @@ class Cookies extends URLSearchParams {
|
|
|
30
30
|
if (Array.isArray(input) && input.every(it => !Array.isArray(it))) {
|
|
31
31
|
input = input.map(it => {
|
|
32
32
|
if (!cookiesTTL) {
|
|
33
|
-
return [it.split(';')
|
|
33
|
+
return [it.split(';')[0].trim()];
|
|
34
34
|
}
|
|
35
35
|
const [cookie, ...attrs] = it.split(';').map(it => it.trim());
|
|
36
36
|
const ttl = {};
|
|
@@ -44,10 +44,10 @@ class Cookies extends URLSearchParams {
|
|
|
44
44
|
return [cookie.replace(/\u0022/g, ''), Object.keys(ttl).length ? ttl : null];
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
super(Array.isArray(input) ? input.map(it => it
|
|
47
|
+
super(Array.isArray(input) ? input.map(it => it[0]).join('&') : input);
|
|
48
48
|
if (Array.isArray(input) && cookiesTTL) {
|
|
49
|
-
for (const [cookie, ttl] of input.filter(it => it
|
|
50
|
-
const key = cookie.split('=')
|
|
49
|
+
for (const [cookie, ttl] of input.filter(it => it[1])) {
|
|
50
|
+
const key = cookie.split('=')[0];
|
|
51
51
|
if (this.#chronometry.has(key)) {
|
|
52
52
|
clearTimeout(this.#chronometry.get(key));
|
|
53
53
|
this.#chronometry.delete(key);
|
package/dist/formdata.cjs
CHANGED
|
@@ -7,7 +7,6 @@ exports.FormData = void 0;
|
|
|
7
7
|
var _nodeBuffer = require("node:buffer");
|
|
8
8
|
var _nodeCrypto = require("node:crypto");
|
|
9
9
|
var _nodeHttp = _interopRequireDefault(require("node:http2"));
|
|
10
|
-
var _nodeUtil = require("node:util");
|
|
11
10
|
var _mediatypes = require("./mediatypes.cjs");
|
|
12
11
|
var _utils = require("./utils.cjs");
|
|
13
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -44,15 +43,15 @@ class FormData {
|
|
|
44
43
|
return FormData.name === val?.[Symbol.toStringTag];
|
|
45
44
|
}
|
|
46
45
|
static #enfoldEntry(name, value, filename) {
|
|
47
|
-
name = (
|
|
48
|
-
filename &&= (
|
|
46
|
+
name = String(name).toWellFormed();
|
|
47
|
+
filename &&= String(filename).toWellFormed();
|
|
49
48
|
if ((0, _utils.isFileLike)(value)) {
|
|
50
49
|
filename ??= value.name || 'blob';
|
|
51
50
|
value = new _nodeBuffer.File([value], filename, value);
|
|
52
51
|
} else if (this.#ensureInstance(value)) {
|
|
53
52
|
value.name = filename;
|
|
54
53
|
} else {
|
|
55
|
-
value = (
|
|
54
|
+
value = String(value).toWellFormed();
|
|
56
55
|
}
|
|
57
56
|
return {
|
|
58
57
|
name,
|
|
@@ -106,7 +105,7 @@ class FormData {
|
|
|
106
105
|
delete(...args) {
|
|
107
106
|
(0, _utils.brandCheck)(this, FormData);
|
|
108
107
|
this.#ensureArgs(args, 1, 'delete');
|
|
109
|
-
const name = (
|
|
108
|
+
const name = String(args[0]).toWellFormed();
|
|
110
109
|
this.#entries = this.#entries.filter(it => it.name !== name);
|
|
111
110
|
}
|
|
112
111
|
forEach(...args) {
|
|
@@ -120,19 +119,19 @@ class FormData {
|
|
|
120
119
|
get(...args) {
|
|
121
120
|
(0, _utils.brandCheck)(this, FormData);
|
|
122
121
|
this.#ensureArgs(args, 1, 'get');
|
|
123
|
-
const name = (
|
|
124
|
-
return
|
|
122
|
+
const name = String(args[0]).toWellFormed();
|
|
123
|
+
return this.#entries.find(it => it.name === name)?.value ?? null;
|
|
125
124
|
}
|
|
126
125
|
getAll(...args) {
|
|
127
126
|
(0, _utils.brandCheck)(this, FormData);
|
|
128
127
|
this.#ensureArgs(args, 1, 'getAll');
|
|
129
|
-
const name = (
|
|
128
|
+
const name = String(args[0]).toWellFormed();
|
|
130
129
|
return this.#entries.filter(it => it.name === name).map(it => it.value);
|
|
131
130
|
}
|
|
132
131
|
has(...args) {
|
|
133
132
|
(0, _utils.brandCheck)(this, FormData);
|
|
134
133
|
this.#ensureArgs(args, 1, 'has');
|
|
135
|
-
const name = (
|
|
134
|
+
const name = String(args[0]).toWellFormed();
|
|
136
135
|
return !!this.#entries.find(it => it.name === name);
|
|
137
136
|
}
|
|
138
137
|
set(...args) {
|
package/package.json
CHANGED
package/src/cookies.js
CHANGED
|
@@ -30,7 +30,7 @@ export class Cookies extends URLSearchParams {
|
|
|
30
30
|
if (Array.isArray(input) && input.every((it) => !Array.isArray(it))) {
|
|
31
31
|
input = input.map((it) => {
|
|
32
32
|
if (!cookiesTTL) {
|
|
33
|
-
return [it.split(';')
|
|
33
|
+
return [it.split(';')[0].trim()];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const [cookie, ...attrs] = it.split(';').map((it) => it.trim());
|
|
@@ -52,11 +52,11 @@ export class Cookies extends URLSearchParams {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
super(Array.isArray(input) ? input.map((it) => it
|
|
55
|
+
super(Array.isArray(input) ? input.map((it) => it[0]).join('&') : input);
|
|
56
56
|
|
|
57
57
|
if (Array.isArray(input) && cookiesTTL) {
|
|
58
|
-
for (const [cookie, ttl] of input.filter((it) => it
|
|
59
|
-
const key = cookie.split('=')
|
|
58
|
+
for (const [cookie, ttl] of input.filter((it) => it[1])) {
|
|
59
|
+
const key = cookie.split('=')[0];
|
|
60
60
|
|
|
61
61
|
if (this.#chronometry.has(key)) {
|
|
62
62
|
clearTimeout(this.#chronometry.get(key));
|
package/src/formdata.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { File } from 'node:buffer';
|
|
2
2
|
import { randomBytes } from 'node:crypto';
|
|
3
3
|
import http2 from 'node:http2';
|
|
4
|
-
import { toUSVString } from 'node:util';
|
|
5
4
|
import {
|
|
6
5
|
APPLICATION_OCTET_STREAM,
|
|
7
6
|
MULTIPART_FORM_DATA,
|
|
@@ -64,8 +63,8 @@ export class FormData {
|
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
static #enfoldEntry(name, value, filename) {
|
|
67
|
-
name =
|
|
68
|
-
filename &&=
|
|
66
|
+
name = String(name).toWellFormed();
|
|
67
|
+
filename &&= String(filename).toWellFormed();
|
|
69
68
|
|
|
70
69
|
if (isFileLike(value)) {
|
|
71
70
|
filename ??= value.name || 'blob';
|
|
@@ -73,7 +72,7 @@ export class FormData {
|
|
|
73
72
|
} else if (this.#ensureInstance(value)) {
|
|
74
73
|
value.name = filename;
|
|
75
74
|
} else {
|
|
76
|
-
value =
|
|
75
|
+
value = String(value).toWellFormed();
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
return {
|
|
@@ -152,7 +151,7 @@ export class FormData {
|
|
|
152
151
|
delete(...args) {
|
|
153
152
|
brandCheck(this, FormData);
|
|
154
153
|
this.#ensureArgs(args, 1, 'delete');
|
|
155
|
-
const name =
|
|
154
|
+
const name = String(args[0]).toWellFormed();
|
|
156
155
|
|
|
157
156
|
this.#entries = this.#entries.filter((it) => it.name !== name);
|
|
158
157
|
}
|
|
@@ -173,15 +172,15 @@ export class FormData {
|
|
|
173
172
|
get(...args) {
|
|
174
173
|
brandCheck(this, FormData);
|
|
175
174
|
this.#ensureArgs(args, 1, 'get');
|
|
176
|
-
const name =
|
|
175
|
+
const name = String(args[0]).toWellFormed();
|
|
177
176
|
|
|
178
|
-
return
|
|
177
|
+
return this.#entries.find((it) => it.name === name)?.value ?? null;
|
|
179
178
|
}
|
|
180
179
|
|
|
181
180
|
getAll(...args) {
|
|
182
181
|
brandCheck(this, FormData);
|
|
183
182
|
this.#ensureArgs(args, 1, 'getAll');
|
|
184
|
-
const name =
|
|
183
|
+
const name = String(args[0]).toWellFormed();
|
|
185
184
|
|
|
186
185
|
return this.#entries.filter((it) => it.name === name).map((it) => it.value);
|
|
187
186
|
}
|
|
@@ -189,7 +188,7 @@ export class FormData {
|
|
|
189
188
|
has(...args) {
|
|
190
189
|
brandCheck(this, FormData);
|
|
191
190
|
this.#ensureArgs(args, 1, 'has');
|
|
192
|
-
const name =
|
|
191
|
+
const name = String(args[0]).toWellFormed();
|
|
193
192
|
|
|
194
193
|
return !!this.#entries.find((it) => it.name === name);
|
|
195
194
|
}
|