EN
JavaScript - how to set axios response type?
1
answers
3
points
How can I set axios response type?
I am using axios.post() method to send request data and I wanted to set the response type to blob.
I need something like:
axios.post('/upload', data, { type: 'blob' })
1 answer
3
points
You can use responseType config option to do so.
Practical example
axios.post('/upload', data, { responseType: 'blob' })
.then((response) => {
const data = response.data; // will have blob type
// ...
})
.catch((error) => {
// ...
});
Available
responseTypevalues:
'arraybuffer''blob''document''json''text''stream'
See also
0 comments
Add comment