Skip to content

Conversation

@lafeuil
Copy link

@lafeuil lafeuil commented Oct 19, 2021

When I want to pipe to the request :

    const body = Readable.from(JSON.stringify({ name: 'john' }));
    const req = request(app)
      .post('/')
      .set('Content-Type', 'application/json')
      .on('response', function (res) {
        should.exist(res);
        res.status.should.be.equal(200);
        res.text.should.be.equal('john');
        done();
      });
    body.pipe(req);

I have an error Uncaught TypeError: Cannot read property 'call' of undefined

This pull request have :

  • a unit test to reproduce the issue
  • the small fix that removes the call to callback function in the end function if it is empty.

@niftylettuce
Copy link
Collaborator

Have you tried again with latest version?

@titanism
Copy link
Collaborator

titanism commented Jul 7, 2025

🎉 This should now be resolved, please upgrade to the latest versions of supertest and superagent:

🔋 Maintenance supported by Forward Email (@forwardemail) at https://forwardemail.net

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

Successfully merging this pull request may close these issues.

3 participants