Skip to content

Commit 1d58d4f

Browse files
authored
fix(server-core): Validation - cors.optionsSuccessStatus should be a number (#7144)
1 parent 5c6a065 commit 1d58d4f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/cubejs-server-core/src/core/optionsValidate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const corsOptions = Joi.object().strict(true).keys({
3737
credentials: Joi.bool(),
3838
maxAge: Joi.number(),
3939
preflightContinue: Joi.bool(),
40-
optionsSuccessStatus: Joi.bool(),
40+
optionsSuccessStatus: Joi.number(),
4141
});
4242

4343
const dbTypes = Joi.alternatives().try(

packages/cubejs-server-core/test/unit/index.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,16 @@ describe('index.test', () => {
284284
subject: 'http://localhost:4000',
285285
claimsNamespace: 'http://localhost:4000',
286286
},
287+
http: {
288+
cors: {
289+
origin: '*',
290+
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
291+
preflightContinue: false,
292+
optionsSuccessStatus: 204,
293+
maxAge: 86400,
294+
credentials: true,
295+
}
296+
},
287297
dashboardAppPath: 'string',
288298
dashboardAppPort: 4444,
289299
livePreview: true,

0 commit comments

Comments
 (0)