http2: compat req.complete

PR-URL: https://github.com/nodejs/node/pull/28627
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Robert Nagy 2019-07-10 21:59:36 +02:00 committed by Rich Trott
parent 7a1f33c394
commit b30dca8d9e
2 changed files with 4 additions and 1 deletions

View File

@ -302,7 +302,8 @@ class Http2ServerRequest extends Readable {
} }
get complete() { get complete() {
return this._readableState.ended || return this[kAborted] ||
this._readableState.ended ||
this[kState].closed || this[kState].closed ||
this[kStream].destroyed; this[kStream].destroyed;
} }

View File

@ -10,8 +10,10 @@ const assert = require('assert');
const server = h2.createServer(common.mustCall(function(req, res) { const server = h2.createServer(common.mustCall(function(req, res) {
req.on('aborted', common.mustCall(function() { req.on('aborted', common.mustCall(function() {
assert.strictEqual(this.aborted, true); assert.strictEqual(this.aborted, true);
assert.strictEqual(this.complete, true);
})); }));
assert.strictEqual(req.aborted, false); assert.strictEqual(req.aborted, false);
assert.strictEqual(req.complete, false);
res.write('hello'); res.write('hello');
server.close(); server.close();
})); }));