Is there are way to add a custom header in JS API?

The issue is that “ngsw-bypass” header is required in Angular applications to bypass service worker.

Without the header, service worker throws this error:

ngsw-worker.js:1308 Fetch API cannot load https://sentry.io/api/1507838/security/?sentry_environment=production&sentry_key=removed&sentry_release=7a490fc. Request mode is “no-cors” but the redirect mode is not “follow”.

Passing a query parameter would also be an option.

Moderator, please remove this question. The problem was solved by just simply appending a correct query parameter. Thank you.