Skip to content
This repository was archived by the owner on Jul 6, 2018. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions test/parallel/test-http2-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ assert(http2.SessionShutdownWrap);
assert.strictEqual(typeof http2.Http2Session, 'function');
assert.strictEqual(typeof http2.SessionShutdownWrap, 'function');

const settings = http2.getDefaultSettings({});
const settings = require('http2').getDefaultSettings();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is require used here, I believe the module cache delivers ithe module anyway from the cache?

assert.strictEqual(settings.headerTableSize, 4096);
assert.strictEqual(settings.enablePush, true);
assert.strictEqual(settings.initialWindowSize, 65535);
Expand All @@ -25,10 +25,9 @@ assert.strictEqual(http2.nghttp2ErrorString(-517),
const check = Buffer.from([0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x04,
0x00, 0x00, 0xff, 0xff, 0x00, 0x05, 0x00, 0x00,
0x40, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01]);
const val = http2.packSettings(http2.getDefaultSettings({}));
const val = http2.packSettings(require('http2').getDefaultSettings());
assert.deepStrictEqual(val, check);

assert.doesNotThrow(() => assert(require('http2').getDefaultSettings()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious: is it that after a packSettings call getDefaultSettings() should throw?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, those are separate operations. packSettings() returns a base64 encoded string with the settings, getDefaultSettings() returns the default settings object.

assert.doesNotThrow(() => {
assert(Buffer.isBuffer(require('http2').getPackedSettings()));
});
Expand Down