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

Readable event broken due to improper stream implementation. #193

Closed
tlivings opened this issue Jun 10, 2014 · 2 comments
Closed

Readable event broken due to improper stream implementation. #193

tlivings opened this issue Jun 10, 2014 · 2 comments

Comments

@tlivings
Copy link

The following would break when parsing an http request in nock:

res.on('readable', function() {
  var chunk;
  while (null !== (chunk = res.read())) {
    console.log('got %d bytes of data', chunk.length);
  }
});

This is because nock doesn't seem to send null to indicate the stream is complete as per the specification here:

The read() method pulls some data out of the internal buffer and returns it. If there is no data available, then it will return null.

@pgte
Copy link
Member

pgte commented Jun 17, 2014

Landed on v0.36.2

@lock
Copy link

lock bot commented Sep 14, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue and add a reference to this one if it’s related. Thank you!

@lock lock bot locked as resolved and limited conversation to collaborators Sep 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants