From da0e99ad8c5b1b3244f1d9c5b92c7fb7d0a21c40 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Fri, 22 Nov 2024 12:17:10 +0200 Subject: [PATCH] refactor: server: auth: destructure --- server/auth.js | 3 ++- server/cloudcmd.spec.mjs | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/auth.js b/server/auth.js index 39b78c9c..e0e40961 100644 --- a/server/auth.js +++ b/server/auth.js @@ -16,8 +16,9 @@ module.exports = (config) => { function _middle(config, authentication, req, res, next) { const is = config('auth'); + const {originalUrl} = req; - if (!is || req.originalUrl.startsWith("/public/")) + if (!is || originalUrl.startsWith('/public/')) return next(); const success = () => next(); diff --git a/server/cloudcmd.spec.mjs b/server/cloudcmd.spec.mjs index 9fc4ce71..01629a92 100644 --- a/server/cloudcmd.spec.mjs +++ b/server/cloudcmd.spec.mjs @@ -186,12 +186,12 @@ test('cloudcmd: manifest.json', async (t) => { const options = { config, - }; - + }; + const {status} = await request.get('/public/manifest.json', { options, }); - + t.equal(status, 200, 'should return manifest.json even when authentication is enabled'); t.end(); });