Skip to content

Response stream need error handling #2

Closed

Description

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

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions