I have the following code being executed to upload media.
const config = {
method: method || 'post',
url,
headers: {
...headers,
...extraHeaders
},
data,
cancelToken: new axios.CancelToken((cancel) => {
// An executor function receives a cancel function as a parameter
cancelFn = cancel;
}),
};
if (onDownloadProgress) {
config.onDownloadProgress = onDownloadProgress;
}
if (onUploadProgress) {
config.onUploadProgress = onUploadProgress;
// config.progress = onUploadProgress; // Tried this too!
}
try {
console.log({config});
response = await axios(config);
} catch (err) {
console.log({err});
response = err.response;
}
console.log(response);
When I pass the method as put, a valid url (without any CORS issue), and callback for onUploadProgress, I find that onUploadProgress is never being called in Desktop Chrome browser. But it is being successfully called in mobile chrome browser. There is not device specific implementation here, the api call is same for any device.
Axios version: 0.27.2