| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dd6444d commit 66788fc
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -84,6 +84,12 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false })); | |||
| 84 | 84 | assert.deepStrictEqual(packed, check); | |
| 85 | 85 | } | |
| 86 | 86 | ||
| 87 | + // check for not passing settings | ||
| 88 | + { | ||
| 89 | + const packed = http2.getPackedSettings(); | ||
| 90 | + assert.strictEqual(packed.length, 0); | ||
| 91 | + } | ||
| 92 | + | ||
| 87 | 93 | { | |
| 88 | 94 | const packed = Buffer.from([ | |
| 89 | 95 | 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x03, 0x00, 0x00, | |
@@ -120,6 +126,33 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false })); | |||
| 120 | 126 | assert.strictEqual(settings.enablePush, true); | |
| 121 | 127 | } | |
| 122 | 128 | ||
| 129 | + //check for what happens if passing {validate: true} and no errors happen | ||
| 130 | + { | ||
| 131 | + const packed = Buffer.from([ | ||
| 132 | + 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x03, 0x00, 0x00, | ||
| 133 | + 0x00, 0xc8, 0x00, 0x05, 0x00, 0x00, 0x4e, 0x20, 0x00, 0x04, | ||
| 134 | + 0x00, 0x00, 0x00, 0x64, 0x00, 0x06, 0x00, 0x00, 0x00, 0x64, | ||
| 135 | + 0x00, 0x02, 0x00, 0x00, 0x00, 0x01]); | ||
| 136 | + | ||
| 137 | + assert.doesNotThrow(() => { | ||
| 138 | + http2.getUnpackedSettings(packed, { validate: true }); | ||
| 139 | + }); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + // check for maxFrameSize failing the max number | ||
| 143 | + { | ||
| 144 | + const packed = Buffer.from([0x00, 0x05, 0x01, 0x00, 0x00, 0x00]); | ||
| 145 | + | ||
| 146 | + assert.throws(() => { | ||
| 147 | + http2.getUnpackedSettings(packed, { validate: true }); | ||
| 148 | + }, common.expectsError({ | ||
| 149 | + code: 'ERR_HTTP2_INVALID_SETTING_VALUE', | ||
| 150 | + type: RangeError, | ||
| 151 | + message: 'Invalid value for setting "maxFrameSize": 16777216' | ||
| 152 | + })); | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + // check for maxConcurrentStreams failing the max number | ||
| 123 | 156 | { | |
| 124 | 157 | const packed = Buffer.from([0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFF]); | |
| 125 | 158 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments