Bypass MSW blocking file upload progress

53 views Asked by At

I have an Angular component that uploads a file and reports the progress. When I am running mock data with msw, the request does not report the file upload progress. As soon as I turn off mock data, it works as expected.

This exact issue happens when using the Angular ngsw-worker for enabling PWA support, however this can easily be resolved by adding ?ngsw-bypass=true as a query param, and I have that handled already like so

    this.uploadUrl = this.swUpdate.isEnabled
      ? this.webserviceUrl.concat('/upload?ngsw-bypass=true')
      : this.webserviceUrl.concat('/upload');

I already have my msw worker configured to bypass all unhandled requests using workers.start({ onUnhandledRequest: 'bypass' });

However, it still prevents the file upload progress from reporting. What is the solution to whitelist or bypass a request similar to the ngsw way?

0

There are 0 answers