aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-http-outgoing-end-multiple.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-http-outgoing-end-multiple.js')
-rw-r--r--test/parallel/test-http-outgoing-end-multiple.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/parallel/test-http-outgoing-end-multiple.js b/test/parallel/test-http-outgoing-end-multiple.js
new file mode 100644
index 0000000000..7c43e1f59d
--- /dev/null
+++ b/test/parallel/test-http-outgoing-end-multiple.js
@@ -0,0 +1,27 @@
+'use strict';
+const common = require('../common');
+const assert = require('assert');
+const http = require('http');
+
+const server = http.createServer(common.mustCall(function(req, res) {
+ res.end('testing ended state', common.mustCall());
+ res.end(common.mustCall());
+ res.on('finish', common.mustCall(() => {
+ res.end(common.mustCall((err) => {
+ assert.strictEqual(err.code, 'ERR_STREAM_ALREADY_FINISHED');
+ server.close();
+ }));
+ }));
+}));
+
+server.listen(0);
+
+server.on('listening', common.mustCall(function() {
+ http
+ .request({
+ port: server.address().port,
+ method: 'GET',
+ path: '/'
+ })
+ .end();
+}));