summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-outgoing-message-inheritance.js
diff options
context:
space:
mode:
authorMatteo Collina <hello@matteocollina.com>2017-07-20 12:08:35 +0200
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2017-07-20 16:17:00 -0400
commit107db33fb9afc0ecbc1207c0587f517b9beba8a3 (patch)
tree779fb687b4e6603ebfa9d5a7908a684ca9a7a159 /test/parallel/test-http-outgoing-message-inheritance.js
parent43e105f6453d50bb667a028d8e85d1882818d16a (diff)
downloadandroid-node-v8-107db33fb9afc0ecbc1207c0587f517b9beba8a3.tar.gz
android-node-v8-107db33fb9afc0ecbc1207c0587f517b9beba8a3.tar.bz2
android-node-v8-107db33fb9afc0ecbc1207c0587f517b9beba8a3.zip
process: triggerAsyncId can be undefined
Fixes: https://github.com/nodejs/node/issues/14386 Fixes: https://github.com/nodejs/node/issues/14381 PR-URL: https://github.com/nodejs/node/pull/14387 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'test/parallel/test-http-outgoing-message-inheritance.js')
-rw-r--r--test/parallel/test-http-outgoing-message-inheritance.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/parallel/test-http-outgoing-message-inheritance.js b/test/parallel/test-http-outgoing-message-inheritance.js
new file mode 100644
index 0000000000..05a241dc8b
--- /dev/null
+++ b/test/parallel/test-http-outgoing-message-inheritance.js
@@ -0,0 +1,32 @@
+'use strict';
+
+const common = require('../common');
+const { OutgoingMessage } = require('http');
+const { Writable } = require('stream');
+const assert = require('assert');
+
+// check that OutgoingMessage can be used without a proper Socket
+// Fixes: https://github.com/nodejs/node/issues/14386
+// Fixes: https://github.com/nodejs/node/issues/14381
+
+class Response extends OutgoingMessage {
+ constructor() {
+ super({ method: 'GET', httpVersionMajor: 1, httpVersionMinor: 1 });
+ }
+
+ _implicitHeader() {}
+}
+
+const res = new Response();
+const ws = new Writable({
+ write: common.mustCall((chunk, encoding, callback) => {
+ assert(chunk.toString().match(/hello world/));
+ setImmediate(callback);
+ })
+});
+
+res.socket = ws;
+ws._httpMessage = res;
+res.connection = ws;
+
+res.end('hello world');