| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ab887bd commit 45e5730
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,35 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + if (!common.hasCrypto) | ||
| 5 | + common.skip('missing crypto'); | ||
| 6 | + | ||
| 7 | + const assert = require('assert'); | ||
| 8 | + const http2 = require('http2'); | ||
| 9 | + | ||
| 10 | + // Error if invalid options are passed to createSecureServer | ||
| 11 | + const invalidOptions = [() => {}, 1, 'test', null, Symbol('test')]; | ||
| 12 | + invalidOptions.forEach((invalidOption) => { | ||
| 13 | + assert.throws( | ||
| 14 | + () => http2.createSecureServer(invalidOption), | ||
| 15 | + { | ||
| 16 | + name: 'TypeError', | ||
| 17 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 18 | + message: 'The "options" argument must be of type Object. Received ' + | ||
| 19 | + `type ${typeof invalidOption}` | ||
| 20 | + } | ||
| 21 | + ); | ||
| 22 | + }); | ||
| 23 | + | ||
| 24 | + // Error if invalid options.settings are passed to createSecureServer | ||
| 25 | + invalidOptions.forEach((invalidSettingsOption) => { | ||
| 26 | + assert.throws( | ||
| 27 | + () => http2.createSecureServer({ settings: invalidSettingsOption }), | ||
| 28 | + { | ||
| 29 | + name: 'TypeError', | ||
| 30 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 31 | + message: 'The "options.settings" property must be of type Object. ' + | ||
| 32 | + `Received type ${typeof invalidSettingsOption}` | ||
| 33 | + } | ||
| 34 | + ); | ||
| 35 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,35 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + if (!common.hasCrypto) | ||
| 5 | + common.skip('missing crypto'); | ||
| 6 | + | ||
| 7 | + const assert = require('assert'); | ||
| 8 | + const http2 = require('http2'); | ||
| 9 | + | ||
| 10 | + // Error if invalid options are passed to createServer | ||
| 11 | + const invalidOptions = [1, true, 'test', null, Symbol('test')]; | ||
| 12 | + invalidOptions.forEach((invalidOption) => { | ||
| 13 | + assert.throws( | ||
| 14 | + () => http2.createServer(invalidOption), | ||
| 15 | + { | ||
| 16 | + name: 'TypeError', | ||
| 17 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 18 | + message: 'The "options" argument must be of type Object. Received ' + | ||
| 19 | + `type ${typeof invalidOption}` | ||
| 20 | + } | ||
| 21 | + ); | ||
| 22 | + }); | ||
| 23 | + | ||
| 24 | + // Error if invalid options.settings are passed to createServer | ||
| 25 | + invalidOptions.forEach((invalidSettingsOption) => { | ||
| 26 | + assert.throws( | ||
| 27 | + () => http2.createServer({ settings: invalidSettingsOption }), | ||
| 28 | + { | ||
| 29 | + name: 'TypeError', | ||
| 30 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 31 | + message: 'The "options.settings" property must be of type Object. ' + | ||
| 32 | + `Received type ${typeof invalidSettingsOption}` | ||
| 33 | + } | ||
| 34 | + ); | ||
| 35 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments