Skip to content

Commit

Permalink
fixup! http: emit 'error' on aborted client response
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed May 1, 2020
1 parent 4bcd762 commit 0c54b5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/api/http.md
Expand Up @@ -2404,7 +2404,7 @@ the following events will be emitted in the following order:
* (connection closed here)
* `'aborted'` on the `res` object
* `'error'` on the `res` object with an error with message
`'Error: socket hang up'` and code `'ECONNRESET'`.
`'Error: aborted'` and code `'ECONNRESET'`.
* `'close'`
* `'close'` on the `res` object

Expand Down Expand Up @@ -2434,7 +2434,7 @@ events will be emitted in the following order:
* (`req.destroy()` called here)
* `'aborted'` on the `res` object
* `'error'` on the `res` object with an error with message
`'Error: socket hang up'` and code `'ECONNRESET'`.
`'Error: aborted'` and code `'ECONNRESET'`.
* `'close'`
* `'close'` on the `res` object

Expand Down Expand Up @@ -2465,7 +2465,7 @@ events will be emitted in the following order:
* `'abort'`
* `'aborted'` on the `res` object
* `'error'` on the `res` object with an error with message
`'Error: socket hang up'` and code `'ECONNRESET'`.
`'Error: aborted'` and code `'ECONNRESET'`.
* `'close'`
* `'close'` on the `res` object

Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-http-aborted.js
Expand Up @@ -11,6 +11,7 @@ const assert = require('assert');
}));
req.on('error', common.mustCall(function(err) {
assert.strictEqual(err.code, 'ECONNRESET');
assert.strictEqual(err.message, 'aborted');
server.close();
}));
assert.strictEqual(req.aborted, false);
Expand All @@ -27,6 +28,7 @@ const assert = require('assert');
}));
res.on('error', common.mustCall((err) => {
assert.strictEqual(err.code, 'ECONNRESET');
assert.strictEqual(err.message, 'aborted');
}));
req.abort();
}));
Expand Down

0 comments on commit 0c54b5f

Please sign in to comment.