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: cleanup of h2 compat layer, add tests · nodejs/node@9490be3

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/http2
    • compat.js
  • test/parallel
    • test-http2-compat-serverrequest-headers.js
    • test-http2-compat-serverrequest.js
    • test-http2-compat-serverresponse-destroy.js
    • test-http2-compat-serverresponse-finished.js
    • test-http2-compat-serverresponse-headers.js
    • test-http2-compat-serverresponse-writehead.js
    • test-http2-createwritereq.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
+111-127Lines changed: 111 additions & 127 deletions
Large diffs are not rendered by default.
Collapse file

‎test/parallel/test-http2-compat-serverrequest-headers.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-compat-serverrequest-headers.js
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ server.listen(0, common.mustCall(function() {
2121
'foo-bar': 'abc123'
2222
};
2323

24+
assert.strictEqual(request.path, undefined);
2425
assert.strictEqual(request.method, expected[':method']);
2526
assert.strictEqual(request.scheme, expected[':scheme']);
26-
assert.strictEqual(request.path, expected[':path']);
2727
assert.strictEqual(request.url, expected[':path']);
2828
assert.strictEqual(request.authority, expected[':authority']);
2929

@@ -41,11 +41,6 @@ server.listen(0, common.mustCall(function() {
4141

4242
request.url = '/one';
4343
assert.strictEqual(request.url, '/one');
44-
assert.strictEqual(request.path, '/one');
45-
46-
request.path = '/two';
47-
assert.strictEqual(request.url, '/two');
48-
assert.strictEqual(request.path, '/two');
4944

5045
response.on('finish', common.mustCall(function() {
5146
server.close();
Collapse file

‎test/parallel/test-http2-compat-serverrequest.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-compat-serverrequest.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ server.listen(0, common.mustCall(function() {
1515
const port = server.address().port;
1616
server.once('request', common.mustCall(function(request, response) {
1717
const expected = {
18-
statusCode: null,
1918
version: '2.0',
2019
httpVersionMajor: 2,
2120
httpVersionMinor: 0
@@ -24,7 +23,6 @@ server.listen(0, common.mustCall(function() {
2423
assert.strictEqual(request.closed, false);
2524
assert.strictEqual(request.code, h2.constants.NGHTTP2_NO_ERROR);
2625

27-
assert.strictEqual(request.statusCode, expected.statusCode);
2826
assert.strictEqual(request.httpVersion, expected.version);
2927
assert.strictEqual(request.httpVersionMajor, expected.httpVersionMajor);
3028
assert.strictEqual(request.httpVersionMinor, expected.httpVersionMinor);
Collapse file

‎test/parallel/test-http2-compat-serverresponse-destroy.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-compat-serverresponse-destroy.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const server = http2.createServer(common.mustCall((req, res) => {
2626
assert.strictEqual(res.closed, true);
2727
}));
2828

29-
if (req.path !== '/') {
29+
if (req.url !== '/') {
3030
nextError = errors.shift();
3131
}
3232
res.destroy(nextError);
Collapse file

‎test/parallel/test-http2-compat-serverresponse-finished.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-compat-serverresponse-finished.js
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ const assert = require('assert');
88
const h2 = require('http2');
99

1010
// Http2ServerResponse.finished
11-
1211
const server = h2.createServer();
1312
server.listen(0, common.mustCall(function() {
1413
const port = server.address().port;
1514
server.once('request', common.mustCall(function(request, response) {
1615
response.on('finish', common.mustCall(function() {
16+
assert.ok(request.stream !== undefined);
17+
assert.ok(response.stream !== undefined);
1718
server.close();
19+
process.nextTick(common.mustCall(() => {
20+
assert.strictEqual(request.stream, undefined);
21+
assert.strictEqual(response.stream, undefined);
22+
}));
1823
}));
1924
assert.strictEqual(response.finished, false);
2025
response.end();
Collapse file

‎test/parallel/test-http2-compat-serverresponse-headers.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-compat-serverresponse-headers.js
+33Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,31 @@ server.listen(0, common.mustCall(function() {
4242
response.removeHeader(denormalised);
4343
assert.strictEqual(response.hasHeader(denormalised), false);
4444

45+
common.expectsError(
46+
() => response.hasHeader(),
47+
{
48+
code: 'ERR_INVALID_ARG_TYPE',
49+
type: TypeError,
50+
message: 'The "name" argument must be of type string'
51+
}
52+
);
53+
common.expectsError(
54+
() => response.getHeader(),
55+
{
56+
code: 'ERR_INVALID_ARG_TYPE',
57+
type: TypeError,
58+
message: 'The "name" argument must be of type string'
59+
}
60+
);
61+
common.expectsError(
62+
() => response.removeHeader(),
63+
{
64+
code: 'ERR_INVALID_ARG_TYPE',
65+
type: TypeError,
66+
message: 'The "name" argument must be of type string'
67+
}
68+
);
69+
4570
[
4671
':status',
4772
':method',
@@ -70,6 +95,14 @@ server.listen(0, common.mustCall(function() {
7095
type: TypeError,
7196
message: 'Value must not be undefined or null'
7297
}));
98+
common.expectsError(
99+
() => response.setHeader(), // header name undefined
100+
{
101+
code: 'ERR_INVALID_ARG_TYPE',
102+
type: TypeError,
103+
message: 'The "name" argument must be of type string'
104+
}
105+
);
73106

74107
response.setHeader(real, expectedValue);
75108
const expectedHeaderNames = [real];
Collapse file

‎test/parallel/test-http2-compat-serverresponse-writehead.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-compat-serverresponse-writehead.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ server.listen(0, common.mustCall(function() {
2222

2323
response.on('finish', common.mustCall(function() {
2424
server.close();
25+
process.nextTick(common.mustCall(() => {
26+
common.expectsError(() => { response.writeHead(300); }, {
27+
code: 'ERR_HTTP2_STREAM_CLOSED'
28+
});
29+
}));
2530
}));
2631
response.end();
2732
}));
Collapse file

‎test/parallel/test-http2-createwritereq.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-createwritereq.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const testsToRun = Object.keys(encodings).length;
3030
let testsFinished = 0;
3131

3232
const server = http2.createServer(common.mustCall((req, res) => {
33-
const testEncoding = encodings[req.path.slice(1)];
33+
const testEncoding = encodings[req.url.slice(1)];
3434

3535
req.on('data', common.mustCall((chunk) => assert.ok(
3636
Buffer.from(testString, testEncoding).equals(chunk)

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.