I'm not sure if is a bug or else but I've a situation where I rely on res.destroy to manually raise an error.
What is the expected behavior?
res.destroy should emit an error event and error is passed as an argument to any listeners on the event
What is the actual behavior?
res.destroy is never called or does not emit error
How to reproduce the issue
const nock = require('nock');
const http = require('http');
nock("http://example.com")
.get("/robots.txt")
.reply(404);
http.get("http://example.com/robots.txt", (res) => {
if (res.statusCode !== 200) {
res.destroy(new Error("Response error"))
return;
}
}).on("error", (err) => {
console.log("Called with error", err);
});
Versions
| Software |
Version(s) |
| Nock |
^10.0.6 |
| Node |
10.15.3 |
I'm not sure if is a bug or else but I've a situation where I rely on res.destroy to manually raise an error.
What is the expected behavior?
res.destroy should emit an
errorevent and error is passed as an argument to any listeners on the eventWhat is the actual behavior?
res.destroy is never called or does not emit error
How to reproduce the issue
Versions