mythix 2.2.0 → 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.0",
3
+ "version": "2.2.3",
4
4
  "description": "Mythix is a NodeJS web-app framework",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -28,9 +28,9 @@
28
28
  "dependencies": {
29
29
  "chokidar": "^3.5.3",
30
30
  "express": "^4.17.3",
31
- "express-busboy": "^8.0.2",
31
+ "express-busboy": "github:th317erd/express-busboy#0754a570d7979097b31e48655b80d3fcd628d4e4",
32
32
  "form-data": "^4.0.0",
33
- "mythix-orm": "^1.2.0",
33
+ "mythix-orm": "^1.3.0",
34
34
  "nife": "^1.11.3",
35
35
  "prompts": "^2.4.2"
36
36
  }
@@ -10,7 +10,7 @@ module.exports = defineCommand('routes', ({ Parent }) => {
10
10
  return class RoutesCommand extends Parent {
11
11
  static description = 'List application routes';
12
12
 
13
- static applicationConfig = { logger: { level: Logger.LEVEL_ERROR } };
13
+ static applicationConfig = { database: false, logger: { level: Logger.LEVEL_ERROR } };
14
14
 
15
15
  buildRoutes(httpServer, routes) {
16
16
  let application = this.getApplication();
@@ -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;
@@ -105,8 +105,10 @@ function conditional(middleware, conditions) {
105
105
 
106
106
  function jsonParser() {
107
107
  return function(request, response, next) {
108
- if (('' + request.headers['content-type']).match(/application\/json/i) && typeof request.body === 'string')
108
+ if (('' + request.headers['content-type']).match(/application\/json/i) && typeof request.body === 'string') {
109
+ request.rawBody = request.body;
109
110
  request.body = JSON.parse(request.body);
111
+ }
110
112
 
111
113
  return next();
112
114
  };