mythix 2.2.2 → 2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mythix",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Mythix is a NodeJS web-app framework",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- /* global process */
3
+ /* global Buffer */
4
4
 
5
5
  const Path = require('path');
6
6
  const FileSystem = require('fs');
@@ -421,6 +421,18 @@ class HTTPServer {
421
421
  // eslint-disable-next-line new-cap
422
422
  let app = Express();
423
423
 
424
+ app.use(Express.raw({ type: 'application/json' }));
425
+
426
+ // Store _rawBody for request
427
+ app.use((request, response, next) => {
428
+ if ((/application\/json/i).test(request.headers['content-type']) && Buffer.isBuffer(request.body)) {
429
+ let bodyStr = request.body.toString('utf8');
430
+ request._rawBody = request.body = bodyStr;
431
+ }
432
+
433
+ next();
434
+ });
435
+
424
436
  ExpressBusBoy.extend(app, options.uploads);
425
437
 
426
438
  return app;