@squiz/edge-dev-render-runtime-lib 2.9.0 → 2.9.1
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/lib/index.js +7 -9
- package/lib/index.js.map +3 -3
- package/lib/public/docs.json +1 -1
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -3154,9 +3154,14 @@ function setupApp(services, config = {}) {
|
|
|
3154
3154
|
initIocContainer(services, config);
|
|
3155
3155
|
const app = (0, import_express.default)();
|
|
3156
3156
|
app.request.services = services;
|
|
3157
|
-
app.options("*", (0, import_cors.default)({ credentials: true }));
|
|
3158
3157
|
app.use((0, import_compression.default)());
|
|
3159
|
-
app.use(
|
|
3158
|
+
app.use(
|
|
3159
|
+
(0, import_cors.default)({
|
|
3160
|
+
credentials: true,
|
|
3161
|
+
methods: ["GET", "PUT", "POST", "PATCH", "DELETE", "OPTIONS"],
|
|
3162
|
+
allowedHeaders: ["Content-Type", "Accept", "X-API-Key", "X-JWT-Token", "X-Requested-With"]
|
|
3163
|
+
})
|
|
3164
|
+
);
|
|
3160
3165
|
app.use(import_express.default.json());
|
|
3161
3166
|
app.use(
|
|
3162
3167
|
(0, import_helmet.default)({
|
|
@@ -3181,13 +3186,6 @@ function setupApp(services, config = {}) {
|
|
|
3181
3186
|
}
|
|
3182
3187
|
})
|
|
3183
3188
|
);
|
|
3184
|
-
app.use((req, res, next) => {
|
|
3185
|
-
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
3186
|
-
res.setHeader("Access-Control-Allow-Methods", "GET,PUT,POST,PATCH,DELETE,OPTIONS");
|
|
3187
|
-
res.setHeader("Access-Control-Allow-Headers", "Content-type,Accept,X-API-Key,X-JWT-Token,X-Requested-With");
|
|
3188
|
-
res.setHeader("Access-Control-Allow-Credentials", "true");
|
|
3189
|
-
next();
|
|
3190
|
-
});
|
|
3191
3189
|
app.use((req, res, next) => {
|
|
3192
3190
|
req.accepts("json");
|
|
3193
3191
|
if (["POST", "PUT", "PATCH"].includes(req.method) && req.header("content-type") !== "application/json") {
|