@spirobel/mininext 0.2.20 → 0.2.22
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/html.js +3 -2
- package/dist/url.js +8 -1
- package/mininext/html.ts +3 -2
- package/mininext/url.ts +7 -1
- package/package.json +1 -1
package/dist/html.js
CHANGED
|
@@ -122,9 +122,10 @@ function JsonTemplateProcessor(danger = false) {
|
|
|
122
122
|
values[index] = value;
|
|
123
123
|
}
|
|
124
124
|
else if (!(value instanceof JsonString)) {
|
|
125
|
-
const notEmpty = value || "";
|
|
126
125
|
// values will be turned into a JSON string
|
|
127
|
-
|
|
126
|
+
if (value) {
|
|
127
|
+
values[index] = JSON.stringify(value);
|
|
128
|
+
}
|
|
128
129
|
}
|
|
129
130
|
jsonStringArray.push(values[index]);
|
|
130
131
|
}
|
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/html.ts
CHANGED
|
@@ -157,9 +157,10 @@ function JsonTemplateProcessor(danger: boolean = false) {
|
|
|
157
157
|
}
|
|
158
158
|
values[index] = value;
|
|
159
159
|
} else if (!(value instanceof JsonString)) {
|
|
160
|
-
const notEmpty = value || "";
|
|
161
160
|
// values will be turned into a JSON string
|
|
162
|
-
|
|
161
|
+
if (value) {
|
|
162
|
+
values[index] = JSON.stringify(value);
|
|
163
|
+
}
|
|
163
164
|
}
|
|
164
165
|
jsonStringArray.push(values[index]);
|
|
165
166
|
}
|
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();
|