Skip to content

Commit

Permalink
Added http header to BrowserFetchStreamTransport that bypasses servic…
Browse files Browse the repository at this point in the history
…e worker onFetch implementation and lets the browser handle the request, specific to angular.

Background on root issue w3c/ServiceWorker#885
Issue leading to work around angular/angular#21191
Workaround that checks for the header petersalomonsen/angular@c7b357a
  • Loading branch information
Bennett Rasmussen committed May 2, 2019
1 parent a576622 commit 2ad1aaa
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export default class BrowserFetchStreamTransport extends BrowserFetchTransport {
const reqHeaders = { ...request.headers };
reqHeaders[Headers.ACCEPT] = ContentTypes.TEXT_EVENT_STREAM;
reqHeaders[Headers.CONTENT_TYPE] = ContentTypes.TEXT_EVENT_STREAM;
// Check for PWA and bypass service worker onFetch specific to angular service-worker.js
if ('ng' in window && 'serviceWorker' in navigator) {
reqHeaders['ngsw-bypass'] = true;
}

// Verify we can start a request with current params and potentially
// Force ourselves to refresh a token.
Expand Down

0 comments on commit 2ad1aaa

Please sign in to comment.