'not able to add headers to response in Angular interceptor

I am trying to headers to response using interceptor but it is not adding to response header..Please help me with the solution

intercept(req: HttpRequest, next: HttpHandler): Observable<HttpEvent> { console.log("entered into xss interceptor");

  return next.handle(req).pipe(
     filter(event => event instanceof HttpResponse),
     tap((event: HttpResponse<any>) => {
       event.headers.append('Content-Security-Policy', "require-trusted-types-for 'script'; default-src 'self'; img-src 'none';style-src 'self' 'unsafe-inline';") ;
     }),
     );

}



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source