rekwest 2.3.2 → 2.3.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/helpers.js +3 -4
- package/package.json +5 -5
- package/src/helpers.mjs +5 -7
package/dist/helpers.js
CHANGED
|
@@ -200,13 +200,12 @@ const premix = (res, {
|
|
|
200
200
|
arrayBuffer: {
|
|
201
201
|
enumerable: true,
|
|
202
202
|
value: async function () {
|
|
203
|
-
|
|
204
|
-
parse = false;
|
|
203
|
+
parse &&= false;
|
|
205
204
|
const {
|
|
206
205
|
buffer,
|
|
207
206
|
byteLength,
|
|
208
207
|
byteOffset
|
|
209
|
-
} = await this.body()
|
|
208
|
+
} = await this.body();
|
|
210
209
|
return buffer.slice(byteOffset, byteOffset + byteLength);
|
|
211
210
|
}
|
|
212
211
|
},
|
|
@@ -258,7 +257,7 @@ const premix = (res, {
|
|
|
258
257
|
|
|
259
258
|
if (spool.length && parse) {
|
|
260
259
|
const contentType = this.headers[HTTP2_HEADER_CONTENT_TYPE] ?? '';
|
|
261
|
-
const charset = contentType.split(';').find(it => /charset=/i.test(it))?.toLowerCase()
|
|
260
|
+
const charset = contentType.split(';').find(it => /charset=/i.test(it))?.toLowerCase().replace('charset=', '').replace('iso-8859-1', 'latin1').trim() || 'utf-8';
|
|
262
261
|
|
|
263
262
|
if (/\bjson\b/i.test(contentType)) {
|
|
264
263
|
spool = JSON.parse(spool.toString(charset));
|
package/package.json
CHANGED
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@babel/cli": "^7.16.8",
|
|
12
|
-
"@babel/core": "^7.16.
|
|
12
|
+
"@babel/core": "^7.16.12",
|
|
13
13
|
"@babel/eslint-parser": "^7.16.5",
|
|
14
|
-
"@babel/preset-env": "^7.16.
|
|
14
|
+
"@babel/preset-env": "^7.16.11",
|
|
15
15
|
"c8": "^7.11.0",
|
|
16
|
-
"eslint": "^8.
|
|
16
|
+
"eslint": "^8.7.0",
|
|
17
17
|
"eslint-config-ultra-refined": "^2.3.0",
|
|
18
|
-
"mocha": "^9.
|
|
18
|
+
"mocha": "^9.2.0"
|
|
19
19
|
},
|
|
20
20
|
"description": "The robust request library that humanity deserves 🌐",
|
|
21
21
|
"engines": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"test": "mocha --exit --recursive",
|
|
60
60
|
"test:cover": "c8 --include=src --reporter=lcov --reporter=text npm test"
|
|
61
61
|
},
|
|
62
|
-
"version": "2.3.
|
|
62
|
+
"version": "2.3.3"
|
|
63
63
|
}
|
package/src/helpers.mjs
CHANGED
|
@@ -183,10 +183,8 @@ export const premix = (res, { digest = false, parse = false } = {}) => {
|
|
|
183
183
|
arrayBuffer: {
|
|
184
184
|
enumerable: true,
|
|
185
185
|
value: async function () {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
parse = false;
|
|
189
|
-
const { buffer, byteLength, byteOffset } = await this.body().finally(() => parse = stash);
|
|
186
|
+
parse &&= false;
|
|
187
|
+
const { buffer, byteLength, byteOffset } = await this.body();
|
|
190
188
|
|
|
191
189
|
return buffer.slice(byteOffset, byteOffset + byteLength);
|
|
192
190
|
},
|
|
@@ -243,9 +241,9 @@ export const premix = (res, { digest = false, parse = false } = {}) => {
|
|
|
243
241
|
const charset = contentType.split(';')
|
|
244
242
|
.find((it) => /charset=/i.test(it))
|
|
245
243
|
?.toLowerCase()
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
.replace('charset=', '')
|
|
245
|
+
.replace('iso-8859-1', 'latin1')
|
|
246
|
+
.trim() || 'utf-8';
|
|
249
247
|
|
|
250
248
|
if (/\bjson\b/i.test(contentType)) {
|
|
251
249
|
spool = JSON.parse(spool.toString(charset));
|