From 26a95679074fcecd9c123decbe949264b47088c3 Mon Sep 17 00:00:00 2001 From: Daniel Nalborczyk Date: Mon, 1 Aug 2022 21:57:46 -0400 Subject: [PATCH] refactor: remove corsAllowCredentials from default options --- src/ServerlessOffline.js | 6 +----- src/config/defaultOptions.js | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ServerlessOffline.js b/src/ServerlessOffline.js index 4f4715deb..16f3f2457 100644 --- a/src/ServerlessOffline.js +++ b/src/ServerlessOffline.js @@ -236,12 +236,8 @@ export default class ServerlessOffline { .replace(/\s/g, '') .split(',') - if (this.#options.corsDisallowCredentials) { - this.#options.corsAllowCredentials = false - } - this.#options.corsConfig = { - credentials: this.#options.corsAllowCredentials, + credentials: !this.#options.corsDisallowCredentials, exposedHeaders: this.#options.corsExposedHeaders, headers: this.#options.corsAllowHeaders, origin: this.#options.corsAllowOrigin, diff --git a/src/config/defaultOptions.js b/src/config/defaultOptions.js index 62ba0f10f..4de9e92d8 100644 --- a/src/config/defaultOptions.js +++ b/src/config/defaultOptions.js @@ -2,9 +2,9 @@ import { createApiKey } from '../utils/index.js' export default { apiKey: createApiKey(), - corsAllowCredentials: true, // TODO no CLI option corsAllowHeaders: 'accept,content-type,x-api-key,authorization', corsAllowOrigin: '*', + corsDisallowCredentials: true, corsExposedHeaders: 'WWW-Authenticate,Server-Authorization', disableCookieValidation: false, disableScheduledEvents: false,