GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http2: expose writable stream state on compat response · nodejs/node@01eed59

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/http2
    • compat.js
  • test/parallel
    • test-http2-res-writable-properties.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/http2/compat.js‎

Copy file name to clipboardExpand all lines: lib/internal/http2/compat.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,10 @@ class Http2ServerResponse extends Stream {
551551
return this[kStream].writableHighWaterMark;
552552
}
553553

554+
get writableObjectMode() {
555+
return this[kStream].writableObjectMode;
556+
}
557+
554558
get writableFinished() {
555559
return this[kStream].writableFinished;
556560
}
@@ -559,6 +563,10 @@ class Http2ServerResponse extends Stream {
559563
return this[kStream].writableLength;
560564
}
561565

566+
get writableNeedDrain() {
567+
return this[kStream].writableNeedDrain;
568+
}
569+
562570
set statusCode(code) {
563571
code |= 0;
564572
if (code >= 100 && code < 200)
Collapse file

‎test/parallel/test-http2-res-writable-properties.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-res-writable-properties.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ const http2 = require('http2');
77
const server = http2.createServer(common.mustCall((req, res) => {
88
const hwm = req.socket.writableHighWaterMark;
99
assert.strictEqual(res.writableHighWaterMark, hwm);
10+
assert.strictEqual(res.writableObjectMode, res.stream.writableObjectMode);
11+
assert.strictEqual(res.writableNeedDrain, res.stream.writableNeedDrain);
1012
assert.strictEqual(res.writableLength, 0);
1113
res.write('');
1214
const len = res.writableLength;
1315
res.write('asd');
1416
assert.strictEqual(res.writableLength, len + 3);
17+
assert.strictEqual(res.writableNeedDrain, res.stream.writableNeedDrain);
1518
res.end();
1619
res.on('finish', common.mustCall(() => {
1720
assert.strictEqual(res.writableLength, 0);

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.