From 0b5283902ee470f79074fd9d9103360decca6d05 Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sun, 13 Aug 2023 23:38:57 +0200 Subject: [PATCH] http2: Add tests for customSettings Test for the http2 settings custom settings were added. --- test/parallel/test-http2-getpackedsettings.js | 12 +++++++++--- test/parallel/test-http2-update-settings.js | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-http2-getpackedsettings.js b/test/parallel/test-http2-getpackedsettings.js index 4f5970522f13b3..f26539a0108e9d 100644 --- a/test/parallel/test-http2-getpackedsettings.js +++ b/test/parallel/test-http2-getpackedsettings.js @@ -29,6 +29,7 @@ assert.deepStrictEqual(val, check); ['maxHeaderListSize', 2 ** 32 - 1], ['maxHeaderSize', 0], ['maxHeaderSize', 2 ** 32 - 1], + ['customSettings', { 9999: 301}] ].forEach((i) => { // Valid options should not throw. http2.getPackedSettings({ [i[0]]: i[1] }); @@ -93,6 +94,8 @@ http2.getPackedSettings({ enablePush: false }); 0x00, 0x05, 0x00, 0x00, 0x4e, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x64, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x27, 0x0F, 0x00, 0x00, 0x01, 0x2d ]); const packed = http2.getPackedSettings({ @@ -104,9 +107,10 @@ http2.getPackedSettings({ enablePush: false }); maxHeaderSize: 100, enablePush: true, enableConnectProtocol: false, - foo: 'ignored' + foo: 'ignored', + customSettings: { 9999: 301} }); - assert.strictEqual(packed.length, 42); + assert.strictEqual(packed.length, 48); assert.deepStrictEqual(packed, check); } @@ -124,7 +128,8 @@ http2.getPackedSettings({ enablePush: false }); 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x06, 0x00, 0x00, 0x00, 0x64, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x08, 0x00, 0x00, 0x00, 0x00]); + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x27, 0x0F, 0x00, 0x00, 0x01, 0x2d]); [1, true, '', [], {}, NaN].forEach((input) => { assert.throws(() => { @@ -157,6 +162,7 @@ http2.getPackedSettings({ enablePush: false }); assert.strictEqual(settings.maxHeaderSize, 100); assert.strictEqual(settings.enablePush, true); assert.strictEqual(settings.enableConnectProtocol, false); + assert.deepStrictEqual(settings.customSettings, { 9999: 301}); } { diff --git a/test/parallel/test-http2-update-settings.js b/test/parallel/test-http2-update-settings.js index e99ee2bcf150d8..69a5d74ac5c444 100644 --- a/test/parallel/test-http2-update-settings.js +++ b/test/parallel/test-http2-update-settings.js @@ -19,7 +19,8 @@ testUpdateSettingsWith({ 'maxHeaderListSize': 1, 'maxFrameSize': 16385, 'enablePush': false, - 'enableConnectProtocol': true + 'enableConnectProtocol': true, + 'customSettings': { 9999: 301} } }); testUpdateSettingsWith({