The provided value 'stream' is not a valid enum value of type XMLHttpRequestResponseType

See original GitHub issue

Summary

I literally copied and pasted the “stream” example and I get the following error:

// GET request for remote image
axios({
  method:'get',
  url:'http://bit.ly/2mTM3nY',
  responseType:'stream'
})
  .then(function(response) {
  response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
});
screen shot 2018-04-10 at 1 44 05 pm

Context

  • axios version: v0.17.1
  • Environment: node v8.2.1, Electron 1.8.4

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:17
  • Comments:14

github_iconTop GitHub Comments

5reactions
GuilhermeAbacherlicommented, Jun 13, 2019

I’m getting this error in web using Vue.

The provided value ‘stream’ is not a valid enum value of type XMLHttpRequestResponseType.

axios.request({ method: 'POST', url: 'http://apilink/endpoint', data: form, headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, responseType: 'stream', // HERE }) .then(response => { console.log('LOGIN response', response); }) .catch(error => { console.log('LOGIN error', error); });

image

  • Axios version in package.json: “axios”: “^0.19.0”;
  • Vue version in package.json: “vue”: “^2.6.10”;
5reactions
chadamscommented, Apr 11, 2018

@nbcnc I figured it out, your making an electron app like me. seems you can only get the response.data as a stream in the main thread. What I did to fix this was add

ipcRenderer.send("download"); // in render thread

then in the main thread

app.on("ready", async () => {

  mainWindow = new BrowserWindow({
    show: false,
    width: 1024,
    height: 728
  });
 mainWindow.loadURL(`file://${__dirname}/app.html`);

 ipcMain.on("download", (event, arg) => {
   // axios download code here
 });

good luck

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Axios to return stream from Express app
Using Axios to return stream from Express app -- "The provided value 'stream' is not a valid enum value of type XMLHttpRequestResponseType.".
Read more >
XMLHttpRequest.responseType - Web APIs | MDN
The XMLHttpRequest property responseType is an enumerated string value specifying the type of data contained in the response.
Read more >
The provided value 'undefined' is not a valid enum value of ...
I'm having a problem to upload my profile image in my application, and I can't figure out why. I published to my images...
Read more >
Photon not working: (frustration) options? - Particle Community
[sm]:42713 The provided value 'ms-stream' is not a valid enum value of type XMLHttpRequestResponseType. bundle.js? [sm]:42713 The provided value ...
Read more >
XMLHttpRequest · Adobe XD Plugin Reference
The default value is 0, which means there is no timeout. ... taken from the XMLHttpRequestResponseType enum which specifies; what type of data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found