Skip to content

Commit

Permalink
http2: compat req.complete
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
ronag authored and targos committed Jul 22, 2019
1 parent 74243da commit 49e4d72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/internal/http2/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-http2-compat-aborted.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}));
Expand Down

0 comments on commit 49e4d72

Please sign in to comment.