@spirobel/mininext 0.2.20 → 0.2.21
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/url.js +8 -1
- package/mininext/url.ts +7 -1
- package/package.json +1 -1
package/dist/url.js
CHANGED
|
@@ -327,7 +327,14 @@ export class url {
|
|
|
327
327
|
const urlencoded = (req.headers.get("Content-Type") + "").includes("application/x-www-form-urlencoded");
|
|
328
328
|
const multipart = (req.headers.get("Content-Type") + "").includes("multipart/form-data");
|
|
329
329
|
if (post && !urlencoded && !multipart) {
|
|
330
|
-
|
|
330
|
+
const length = Number(req.headers.get("content-length"));
|
|
331
|
+
const bodyNotEmpty = length > 0;
|
|
332
|
+
if (bodyNotEmpty) {
|
|
333
|
+
formJson = await req.json();
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
formJson = {};
|
|
337
|
+
}
|
|
331
338
|
}
|
|
332
339
|
if (post && (urlencoded || multipart)) {
|
|
333
340
|
formData = await req.formData();
|
package/mininext/url.ts
CHANGED
|
@@ -425,7 +425,13 @@ export class url {
|
|
|
425
425
|
"multipart/form-data"
|
|
426
426
|
);
|
|
427
427
|
if (post && !urlencoded && !multipart) {
|
|
428
|
-
|
|
428
|
+
const length = Number(req.headers.get("content-length"));
|
|
429
|
+
const bodyNotEmpty = length > 0;
|
|
430
|
+
if (bodyNotEmpty) {
|
|
431
|
+
formJson = await req.json();
|
|
432
|
+
} else {
|
|
433
|
+
formJson = {};
|
|
434
|
+
}
|
|
429
435
|
}
|
|
430
436
|
if (post && (urlencoded || multipart)) {
|
|
431
437
|
formData = await req.formData();
|