diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 516954587108a8..c707c22be987c8 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -302,7 +302,8 @@ class Http2ServerRequest extends Readable { } get complete() { - return this._readableState.ended || + return this[kAborted] || + this._readableState.ended || this[kState].closed || this[kStream].destroyed; } diff --git a/test/parallel/test-http2-compat-aborted.js b/test/parallel/test-http2-compat-aborted.js index 01caf95f98688a..0ed0d800435f38 100644 --- a/test/parallel/test-http2-compat-aborted.js +++ b/test/parallel/test-http2-compat-aborted.js @@ -10,8 +10,10 @@ const assert = require('assert'); const server = h2.createServer(common.mustCall(function(req, res) { req.on('aborted', common.mustCall(function() { assert.strictEqual(this.aborted, true); + assert.strictEqual(this.complete, true); })); assert.strictEqual(req.aborted, false); + assert.strictEqual(req.complete, false); res.write('hello'); server.close(); }));