Skip to content

Commit

Permalink
fix: move the set header to attempt better coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterMoar committed Feb 14, 2025
1 parent c73b317 commit fbd10dd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ const state = {

let probeId;
const app = express();

// Set the CSP header so that external media cannot be displayed in the forms.
app.use((_req, res, next) => {
res.setHeader('Content-Security-Policy', "default-src 'self'");
next();
});

app.use(compression());
app.use(express.json({ limit: config.get('server.bodyLimit') }));
app.use(express.urlencoded({ extended: true }));
Expand Down Expand Up @@ -59,12 +66,6 @@ app.use((_req, res, next) => {

app.use(config.get('server.basePath') + config.get('server.apiPath'), rateLimiter);

// Set the CSP header so that external media cannot be displayed in the forms.
app.use((_req, res, next) => {
res.setHeader('Content-Security-Policy', "default-src 'self'");
next();
});

// Frontend configuration endpoint
apiRouter.use('/config', (_req, res, next) => {
try {
Expand Down

0 comments on commit fbd10dd

Please sign in to comment.