@jaypie/express 1.1.3 → 1.1.4

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/dist/module.cjs CHANGED
@@ -106,7 +106,16 @@ var cors_helper = (config) => {
106
106
  const cors = corsHelper(config);
107
107
  return (req, res, next) => {
108
108
  console.log("Run cors middleware");
109
- cors(req, res, next);
109
+ cors(req, res, (error) => {
110
+ if (error) {
111
+ res.status(error.status);
112
+ res.setHeader("Content-Type", "application/json");
113
+ console.log("Return cors error");
114
+ return res.json(error.toJSON());
115
+ }
116
+ console.log("Allow next");
117
+ next();
118
+ });
110
119
  };
111
120
  };
112
121
 
@@ -104,7 +104,16 @@ var cors_helper = (config) => {
104
104
  const cors = corsHelper(config);
105
105
  return (req, res, next) => {
106
106
  console.log("Run cors middleware");
107
- cors(req, res, next);
107
+ cors(req, res, (error) => {
108
+ if (error) {
109
+ res.status(error.status);
110
+ res.setHeader("Content-Type", "application/json");
111
+ console.log("Return cors error");
112
+ return res.json(error.toJSON());
113
+ }
114
+ console.log("Allow next");
115
+ next();
116
+ });
108
117
  };
109
118
  };
110
119
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/express",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "license": "MIT",
5
5
  "author": "Finlayson Studio",
6
6
  "type": "module",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "cb9bf6543a9bd07129ea9354ceea73df0461de87"
46
+ "gitHead": "7f489ba1dd28a86aeb8cb3764797ba50c0626e9b"
47
47
  }
@@ -89,6 +89,15 @@ export default (config) => {
89
89
  const cors = corsHelper(config);
90
90
  return (req, res, next) => {
91
91
  console.log("Run cors middleware");
92
- cors(req, res, next);
92
+ cors(req, res, (error) => {
93
+ if (error) {
94
+ res.status(error.status);
95
+ res.setHeader("Content-Type", "application/json");
96
+ console.log("Return cors error");
97
+ return res.json(error.toJSON());
98
+ }
99
+ console.log("Allow next");
100
+ next();
101
+ });
93
102
  };
94
103
  };