import { session } from 'electron';
import OnHeadersReceivedDetails = Electron.OnHeadersReceivedDetails;

export function setHeaders(): void {
  // these headers only work on web requests, file:// protocol is handled via meta tags in the html
  session.defaultSession.webRequest.onHeadersReceived(
    (details: OnHeadersReceivedDetails, callback: (response: {}) => void) => {
      callback({
        responseHeaders: {
          ...details.responseHeaders,
          'Content-Security-Policy': ["default-src 'none'"],
        },
      });
    }
  );
}
