Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response stream need error handling #2

Closed
code-d opened this issue Dec 20, 2017 · 0 comments
Closed

Response stream need error handling #2

code-d opened this issue Dec 20, 2017 · 0 comments
Assignees
Milestone

Comments

@code-d
Copy link

code-d commented Dec 20, 2017

need readable.on('error', ...), otherwise current process will cash when gzip is used and response data is corrupted

let headers = { 'Accept-Encoding': 'gzip, deflate' };
let request = require('request-light');

setInterval(() => {
  console.log('process running..');
}, 2000);

request.xhr({ url: 'http://json.schemastore.org/tsconfig', followRedirects: 5, headers: headers })
  .then(res => {
    console.log('res', res);
  })
  .catch(err => {
    console.error('err');
  });
node xhr-test.js 
events.js:193
      throw er; // Unhandled 'error' event
      ^

Error: incorrect data check
    at Zlib.zlibOnError [as onerror] (zlib.js:133:17)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants