Skip to content

Commit 247a516

Browse files
committed
review: refactor setHeader for google analytics
1 parent 773008f commit 247a516

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/app.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,14 @@ app.use((request: Request, response: Response, next: NextFunction) => {
3535
"Access-Control-Allow-Methods",
3636
"GET, POST, PUT, DELETE, PATCH, OPTIONS"
3737
);
38+
// allow scripts from https://www.googletagmanager.com
39+
response.setHeader(
40+
"Content-Security-Policy",
41+
"script-src 'self' https://www.googletagmanager.com"
42+
);
3843
next();
3944
});
4045

41-
// allow scripts from https://www.googletagmanager.com
42-
app.use((request: Request, response: Response, next: NextFunction) => {
43-
response.setHeader(
44-
"Content-Security-Policy",
45-
"script-src 'self' https://www.googletagmanager.com"
46-
);
47-
next();
48-
});
49-
5046
app.use("/", mainRoutes);
5147
app.use("/planning", planningRoutes);
5248
app.use("/auth", userRoutes);

0 commit comments

Comments
 (0)