From 49e4d72b5a7fcf643e1476b0f382ed08cacd6c0a Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 10 Jul 2019 21:59:36 +0200 Subject: http2: compat req.complete PR-URL: https://github.com/nodejs/node/pull/28627 Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Benjamin Gruenbaum Reviewed-By: Rich Trott --- lib/internal/http2/compat.js | 3 ++- test/parallel/test-http2-compat-aborted.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 5169545871..c707c22be9 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 01caf95f98..0ed0d80043 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(); })); -- cgit v1.2.3