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

HTTP IncomingMessage (response) complete property is false #1493

Closed
kadler15 opened this issue Apr 2, 2019 · 3 comments
Closed

HTTP IncomingMessage (response) complete property is false #1493

kadler15 opened this issue Apr 2, 2019 · 3 comments

Comments

@kadler15
Copy link

kadler15 commented Apr 2, 2019

Not sure how much of this is mocked as part of this library, but I noticed that the complete property on the response to a http request remains false, even after the entire reply message is received by the client (data and end events handled). E.g.:

nock('http://test.com')
  .replyDate()
  .defaultReplyHeaders({
    'Content-Type': 'application/text',
    'Content-Length': function(req, res, body) { return body.length; },
  })
  .get('/testFile.txt')
  .reply(200, Buffer.from(new Array(10000).fill('a')));
http.request({
  method: 'GET',
  url: 'http://test.com/testFile.txt'
  host: 'test.com',
  path: '/testFile.txt'
}, function(response) {
  const data = []
  response.on('data', function(chunk) { data.push(chunk); });
  response.on('end', function() {
    if (!response.complete) {
      console.log('Connection terminated while the message was being sent');  // <-- The case with nock
    } else {
      console.log('Entire message received');
    }
  });
});
@stale
Copy link

stale bot commented Jul 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We try to do our best, but nock is maintained by volunteers and there is only so much we can do at a time. Thank you for your contributions.

@nockbot
Copy link
Collaborator

nockbot commented Jul 15, 2019

🎉 This issue has been resolved in version 11.0.0-beta.24 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nockbot
Copy link
Collaborator

nockbot commented Aug 13, 2019

🎉 This issue has been resolved in version 11.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants