Skip to content
Discussion options

You must be logged in to vote

Solution

For anyone encountering this, here's how to fix this. You have to use the XMLHttpRequestInterceptor from @mswjs/interceptors manually to intercept XHR requests and support upload there. The Service Worker API coerces all intercepted requests to Fetch API requests, and those do not have a concept of upload progress.

Here's an example of how to use Interceptors to resolve your existing request handlers against an XHR interceptor that does support the upload progress:

import { getResponse } from 'msw'
import { XMLHttpRequestInterceptor } from '@mswjs/interceptors/XMLHttpRequest'
import { handlers } from './your/handlers/here'

const interceptor = new XMLHttpRequestInterceptor()
inte…

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
3 replies
@Ahmad-Alzamer
Comment options

@williamisnotdefined
Comment options

@Ahmad-Alzamer
Comment options

Comment options

You must be logged in to vote
2 replies
@Ahmad-Alzamer
Comment options

@kettanaito
Comment options

Comment options

You must be logged in to vote
1 reply
@kettanaito
Comment options

Answer selected by kettanaito
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants