Skip to content

Commit 9b23524

Browse files
committed
http2: Add tests for customSettings
Test for the http2 settings custom settings were added.
1 parent 623e50b commit 9b23524

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

test/parallel/test-http2-getpackedsettings.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ assert.deepStrictEqual(val, check);
2929
['maxHeaderListSize', 2 ** 32 - 1],
3030
['maxHeaderSize', 0],
3131
['maxHeaderSize', 2 ** 32 - 1],
32+
['customSettings', { 9999: 301}]
3233
].forEach((i) => {
3334
// Valid options should not throw.
3435
http2.getPackedSettings({ [i[0]]: i[1] });
@@ -93,6 +94,8 @@ http2.getPackedSettings({ enablePush: false });
9394
0x00, 0x05, 0x00, 0x00, 0x4e, 0x20,
9495
0x00, 0x06, 0x00, 0x00, 0x00, 0x64,
9596
0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
97+
0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
98+
0x27, 0x0F, 0x00, 0x00, 0x01, 0x2d
9699
]);
97100

98101
const packed = http2.getPackedSettings({
@@ -104,9 +107,10 @@ http2.getPackedSettings({ enablePush: false });
104107
maxHeaderSize: 100,
105108
enablePush: true,
106109
enableConnectProtocol: false,
107-
foo: 'ignored'
110+
foo: 'ignored',
111+
customSettings: { 9999: 301}
108112
});
109-
assert.strictEqual(packed.length, 42);
113+
assert.strictEqual(packed.length, 48);
110114
assert.deepStrictEqual(packed, check);
111115
}
112116

@@ -124,7 +128,8 @@ http2.getPackedSettings({ enablePush: false });
124128
0x00, 0x04, 0x00, 0x00, 0x00, 0x64,
125129
0x00, 0x06, 0x00, 0x00, 0x00, 0x64,
126130
0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
127-
0x00, 0x08, 0x00, 0x00, 0x00, 0x00]);
131+
0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
132+
0x27, 0x0F, 0x00, 0x00, 0x01, 0x2d]);
128133

129134
[1, true, '', [], {}, NaN].forEach((input) => {
130135
assert.throws(() => {
@@ -157,6 +162,7 @@ http2.getPackedSettings({ enablePush: false });
157162
assert.strictEqual(settings.maxHeaderSize, 100);
158163
assert.strictEqual(settings.enablePush, true);
159164
assert.strictEqual(settings.enableConnectProtocol, false);
165+
assert.deepStrictEqual(settings.customSettings, { 9999: 301});
160166
}
161167

162168
{

test/parallel/test-http2-update-settings.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ testUpdateSettingsWith({
1919
'maxHeaderListSize': 1,
2020
'maxFrameSize': 16385,
2121
'enablePush': false,
22-
'enableConnectProtocol': true
22+
'enableConnectProtocol': true,
23+
'customSettings': { 9999: 301}
2324
}
2425
});
2526
testUpdateSettingsWith({

0 commit comments

Comments
 (0)