Skip to content

OutgoingMessage doesn't always emit close #33653

@ronag

Description

@ronag

Following test fails:

  const msg = new OutgoingMessage();
  assert.strictEqual(msg.destroyed, false);
  msg.destroy();
  assert.strictEqual(msg.destroyed, true);
  let callbackCalled = false;
  msg.write('asd', common.mustCall((err) => {
    assert.strictEqual(err.code, 'ERR_STREAM_DESTROYED');
    callbackCalled = true;
  }));
  msg.on('error', common.mustCall((err) => {
    assert.strictEqual(err.code, 'ERR_STREAM_DESTROYED');
    assert.strictEqual(callbackCalled, true);
  }));
  msg.on('close', common.mustCall(() => {
    // Won't call
    msg.end();
  }));

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.httpIssues or PRs related to the http subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions