@webtypen/webframez-core 0.0.9 → 0.0.10

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.
@@ -236,7 +236,13 @@ class RouterFacade {
236
236
  });
237
237
  try {
238
238
  yield route.component({
239
- body: bodyPlain ? qs_1.default.parse(bodyPlain) : {},
239
+ body: bodyPlain &&
240
+ req.headers["content-type"] === "application/json" &&
241
+ (bodyPlain.trim().substring(0, 1) === "[" || bodyPlain.trim().substring(0, 1) === "{")
242
+ ? JSON.parse(bodyPlain)
243
+ : bodyPlain
244
+ ? qs_1.default.parse(bodyPlain)
245
+ : {},
240
246
  bodyPlain: bodyPlain,
241
247
  params: route.params,
242
248
  httpVersionMajor: req.httpVersionMajor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "The core package of the typescript based webframez (web-framework) by webtypen.de",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "license": "MIT",
@@ -290,7 +290,14 @@ class RouterFacade {
290
290
  try {
291
291
  await route.component(
292
292
  {
293
- body: bodyPlain ? qs.parse(bodyPlain) : {},
293
+ body:
294
+ bodyPlain &&
295
+ req.headers["content-type"] === "application/json" &&
296
+ (bodyPlain.trim().substring(0, 1) === "[" || bodyPlain.trim().substring(0, 1) === "{")
297
+ ? JSON.parse(bodyPlain)
298
+ : bodyPlain
299
+ ? qs.parse(bodyPlain)
300
+ : {},
294
301
  bodyPlain: bodyPlain,
295
302
  params: route.params,
296
303
  httpVersionMajor: req.httpVersionMajor,