Skip to content

Commit 1d40850

Browse files
evanlucasaddaleax
authored andcommitted
http2: fix [kInspect]() output for Http2Stream
This fixes a typo in the util.inspect output of Http2Stream. It previously had writeableSate instead of writableState. PR-URL: #14753 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 621c03a commit 1d40850

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

lib/internal/http2/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ class Http2Stream extends Duplex {
13151315
id: this[kID],
13161316
state: this.state,
13171317
readableState: this._readableState,
1318-
writeableSate: this._writableState
1318+
writableState: this._writableState
13191319
};
13201320
return `Http2Stream ${util.format(obj)}`;
13211321
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Flags: --expose-http2
2+
'use strict';
3+
4+
const common = require('../common');
5+
if (!common.hasCrypto)
6+
common.skip('missing crypto');
7+
const assert = require('assert');
8+
const http2 = require('http2');
9+
const util = require('util');
10+
11+
const server = http2.createServer();
12+
server.on('stream', common.mustCall((stream) => {
13+
assert.strictEqual(stream.aborted, false);
14+
const insp = util.inspect(stream);
15+
assert.ok(/Http2Stream { id/.test(insp));
16+
assert.ok(/ state:/.test(insp));
17+
assert.ok(/ readableState:/.test(insp));
18+
assert.ok(/ writableState:/.test(insp));
19+
stream.end('ok');
20+
}));
21+
server.listen(0, common.mustCall(() => {
22+
const client = http2.connect(`http://localhost:${server.address().port}`);
23+
const req = client.request();
24+
req.resume();
25+
req.on('streamClosed', common.mustCall(() => {
26+
client.destroy();
27+
server.close();
28+
}));
29+
}));

0 commit comments

Comments
 (0)