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: add `bytesWritten` test for `Http2Stream` · nodejs/node@41c5524

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-http2-byteswritten-server.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-http2-byteswritten-server.js‎

Copy file name to clipboard
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
6+
const assert = require('assert');
7+
const http2 = require('http2');
8+
9+
const http2Server = http2.createServer(common.mustCall(function(req, res) {
10+
res.socket.on('finish', common.mustCall(() => {
11+
assert(req.socket.bytesWritten > 0); // 1094
12+
}));
13+
res.writeHead(200, { 'Content-Type': 'text/plain' });
14+
res.write(Buffer.from('1'.repeat(1024)));
15+
res.end();
16+
}));
17+
18+
http2Server.listen(0, common.mustCall(function() {
19+
const URL = `http://localhost:${http2Server.address().port}`;
20+
const http2client = http2.connect(URL, { protocol: 'http:' });
21+
const req = http2client.request({ ':method': 'GET', ':path': '/' });
22+
req.on('data', common.mustCall());
23+
req.on('end', common.mustCall(function() {
24+
http2client.close();
25+
http2Server.close();
26+
}));
27+
req.end();
28+
}));

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.