Skip to content

error event not emitted when destroying an HTTP request without a socket #34651

@szmarczak

Description

@szmarczak

What steps will reproduce the bug?

const http = require('http');
const net = require('net');

const request = http.get('http://example.com', {
    createConnection: () => null
});

request.once('error', console.error);

request.destroy(new Error('Oh no.'));

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior?

Error: Oh no.

What do you see instead?

(hangs indefinitely)

Metadata

Metadata

Assignees

No one assigned

    Labels

    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