c2-http 1.0.166 → 1.0.168

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.
@@ -14,7 +14,9 @@ class MiddlewareBody {
14
14
  // Adicionar parser para tipos não especificados
15
15
  expressApplication.use(body_parser_1.default.raw({ limit: "25mb", type: "*/*" }));
16
16
  expressApplication.use((request, response, next) => {
17
- (0, c2_util_1.log)("LOG_BODY", "Body middleware enabled");
17
+ // log("LOG_BODY", "Body middleware enabled")
18
+ (0, c2_util_1.log)("LOG_REQUEST_URL", request.originalUrl);
19
+ (0, c2_util_1.log)("LOG_BODY_SIZE_IN_MB", request.body.length / 1024 / 1024);
18
20
  if (request.body && typeof request.body === "object") {
19
21
  // this.convertDates(request.body, request.headers)
20
22
  }
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const c2_util_1 = require("c2-util");
6
7
  const cors_1 = __importDefault(require("cors"));
7
8
  class MiddlewareCors {
8
9
  config(expressApplication) {
@@ -14,10 +15,13 @@ class MiddlewareCors {
14
15
  if (!process.env.ORIGIN_ENABLES) {
15
16
  return callback(null, true);
16
17
  }
18
+ (0, c2_util_1.log)("ORIGIN", process.env.ORIGIN_ENABLES.split(",").indexOf(origin));
17
19
  if (process.env.ORIGIN_ENABLES.split(",").indexOf(origin) === -1) {
20
+ (0, c2_util_1.log)("ORIGIN_NOT_ALLOWED", origin);
18
21
  const msg = "Acesso não permitido para esta origem";
19
22
  return callback(new Error(msg), false);
20
23
  }
24
+ (0, c2_util_1.log)("ORIGIN_ALLOWED", origin);
21
25
  return callback(null, true);
22
26
  },
23
27
  methods: "GET,OPTIONS,PUT,POST,PATCH,DELETE",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-http",
3
- "version": "1.0.166",
3
+ "version": "1.0.168",
4
4
  "description": "Biblioteca Typescript para API NodeJS",
5
5
  "repository": "https://cabralsilva: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@github.com/cabralsilva/c2-http.git",
6
6
  "author": "Daniel Cabral <cabralconsultoriaemsoftware@gmail.com>",