Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes-Andersen committed Nov 18, 2023
1 parent 54289a8 commit 41f995a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ export function middleware(request: NextRequest) {
block-all-mixed-content;
upgrade-insecure-requests;
sandbox allow-forms allow-same-origin allow-scripts allow-top-navigation allow-popups;
`
`
// Replace newline characters and spaces
const contentSecurityPolicyHeaderValue = cspHeader
.replace(/\s{2,}/g, ' ')
.trim()

const requestHeaders = new Headers(request.headers)
requestHeaders.set('x-nonce', nonce)

requestHeaders.set(
'Content-Security-Policy',
contentSecurityPolicyHeaderValue
)

const response = NextResponse.next({
headers: requestHeaders,
request: {
Expand All @@ -45,7 +45,7 @@ export function middleware(request: NextRequest) {
'Content-Security-Policy',
contentSecurityPolicyHeaderValue
)

return response
}

Expand Down

0 comments on commit 41f995a

Please sign in to comment.