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 — test: verify order of error in h2 server stream · nodejs/node@8ffe04f

File tree

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

‎test/parallel/test-http2-error-order.js‎

Copy file name to clipboard
+43Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
6+
7+
const assert = require('assert');
8+
const { createServer, connect } = require('http2');
9+
10+
const messages = [];
11+
const expected = [
12+
'Stream:created',
13+
'Stream:error',
14+
'Stream:close',
15+
'Request:error'
16+
];
17+
18+
const server = createServer();
19+
20+
server.on('stream', (stream) => {
21+
messages.push('Stream:created');
22+
stream
23+
.on('close', () => messages.push('Stream:close'))
24+
.on('error', (err) => messages.push('Stream:error'))
25+
.respondWithFile('dont exist');
26+
});
27+
28+
server.listen(0);
29+
30+
const client = connect(`http://localhost:${server.address().port}`);
31+
const req = client.request();
32+
33+
req.on('response', common.mustNotCall());
34+
35+
req.on('error', () => {
36+
messages.push('Request:error');
37+
client.close();
38+
});
39+
40+
client.on('close', common.mustCall(() => {
41+
assert.deepStrictEqual(messages, expected);
42+
server.close();
43+
}));

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.