Skip to content

Commit

Permalink
fix(server): convert content-type to lowercase before checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Apr 30, 2024
1 parent ffe446d commit 4f1af67
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,16 @@ async function plugin(server, config) {
*/
.addHook("onSend", async (_req, res, payload) => {
if (
!res.getHeader("content-type")?.toString()?.includes("html") &&
!res.getHeader("content-type")?.toString()?.includes("xml")
!res
.getHeader("content-type")
?.toString()
.toLowerCase()
.includes("html") &&
!res
.getHeader("content-type")
?.toString()
.toLowerCase()
.includes("xml")
) {
res.header(
"content-security-policy",
Expand Down

0 comments on commit 4f1af67

Please sign in to comment.