c2-http 1.0.141 → 1.0.142

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.
@@ -3,31 +3,27 @@ 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");
7
6
  const cors_1 = __importDefault(require("cors"));
8
7
  class MiddlewareCors {
9
8
  config(expressApplication) {
10
- expressApplication.use(() => {
11
- (0, c2_util_1.log)("LOG_CORS", "CORS middleware enabled");
12
- return (0, cors_1.default)({
13
- origin: (origin, callback) => {
14
- // Permitir solicitações sem uma origem
15
- if (!origin)
16
- return callback(null, true);
17
- if (!process.env.ORIGIN_ENABLES) {
18
- return callback(null, true);
19
- }
20
- if (process.env.ORIGIN_ENABLES.split(",").indexOf(origin) === -1) {
21
- const msg = "Acesso não permitido para esta origem";
22
- return callback(new Error(msg), false);
23
- }
9
+ expressApplication.use((0, cors_1.default)({
10
+ origin: (origin, callback) => {
11
+ // Permitir solicitações sem uma origem
12
+ if (!origin)
24
13
  return callback(null, true);
25
- },
26
- methods: "GET,OPTIONS,PUT,POST,PATCH,DELETE",
27
- allowedHeaders: "Content-Type,Authorization,Origin,Accept",
28
- credentials: true
29
- });
30
- });
14
+ if (!process.env.ORIGIN_ENABLES) {
15
+ return callback(null, true);
16
+ }
17
+ if (process.env.ORIGIN_ENABLES.split(",").indexOf(origin) === -1) {
18
+ const msg = "Acesso não permitido para esta origem";
19
+ return callback(new Error(msg), false);
20
+ }
21
+ return callback(null, true);
22
+ },
23
+ methods: "GET,OPTIONS,PUT,POST,PATCH,DELETE",
24
+ allowedHeaders: "Content-Type,Authorization,Origin,Accept",
25
+ credentials: true
26
+ }));
31
27
  }
32
28
  }
33
29
  exports.default = new MiddlewareCors;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-http",
3
- "version": "1.0.141",
3
+ "version": "1.0.142",
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>",