How to mock axios put or post request with onUploadProgress config using MSW #1612
Unanswered
chetankondawle
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an file upload API, which has a config to check the progress of file being uplaoded using onUploadProgress. It takes a callback, which takes a progressEvent as ain argument, which gives me total file size and uploaded file size.
I tried mocking this particular upload api request with MSW. MSW does not intercept the request and directly the catch block is called in test case. When, I remvoe the onUploadProgress config, MSW intercepts the request and returns the resposne correctly.
How to mock the request which has onUploadProgress config using MSW?
Here is the code snippet for axios config.
Form data holds the file object .
Beta Was this translation helpful? Give feedback.
All reactions