| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1b0cc79 commit d6fc855
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -228,11 +228,10 @@ function ClientRequest(input, options, cb) { | |||
| 228 | 228 | this.maxHeaderSize = maxHeaderSize; | |
| 229 | 229 | ||
| 230 | 230 | const insecureHTTPParser = options.insecureHTTPParser; | |
| 231 | - if (insecureHTTPParser !== undefined && | ||
| 232 | - typeof insecureHTTPParser !== 'boolean') { | ||
| 233 | - throw new ERR_INVALID_ARG_TYPE( | ||
| 234 | - 'options.insecureHTTPParser', 'boolean', insecureHTTPParser); | ||
| 231 | + if (insecureHTTPParser !== undefined) { | ||
| 232 | + validateBoolean(insecureHTTPParser, 'options.insecureHTTPParser'); | ||
| 235 | 233 | } | |
| 234 | + | ||
| 236 | 235 | this.insecureHTTPParser = insecureHTTPParser; | |
| 237 | 236 | ||
| 238 | 237 | if (options.joinDuplicateHeaders !== undefined) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1224,21 +1224,16 @@ function Server(options, listener) { | |||
| 1224 | 1224 | ||
| 1225 | 1225 | validateNumber(this[kHandshakeTimeout], 'options.handshakeTimeout'); | |
| 1226 | 1226 | ||
| 1227 | - if (this[kSNICallback] && typeof this[kSNICallback] !== 'function') { | ||
| 1228 | - throw new ERR_INVALID_ARG_TYPE( | ||
| 1229 | - 'options.SNICallback', 'function', options.SNICallback); | ||
| 1227 | + if (this[kSNICallback]) { | ||
| 1228 | + validateFunction(this[kSNICallback], 'options.SNICallback'); | ||
| 1230 | 1229 | } | |
| 1231 | 1230 | ||
| 1232 | - if (this[kPskCallback] && typeof this[kPskCallback] !== 'function') { | ||
| 1233 | - throw new ERR_INVALID_ARG_TYPE( | ||
| 1234 | - 'options.pskCallback', 'function', options.pskCallback); | ||
| 1231 | + if (this[kPskCallback]) { | ||
| 1232 | + validateFunction(this[kPskCallback], 'options.pskCallback'); | ||
| 1235 | 1233 | } | |
| 1236 | - if (this[kPskIdentityHint] && typeof this[kPskIdentityHint] !== 'string') { | ||
| 1237 | - throw new ERR_INVALID_ARG_TYPE( | ||
| 1238 | - 'options.pskIdentityHint', | ||
| 1239 | - 'string', | ||
| 1240 | - options.pskIdentityHint | ||
| 1241 | - ); | ||
| 1234 | + | ||
| 1235 | + if (this[kPskIdentityHint]) { | ||
| 1236 | + validateString(this[kPskIdentityHint], 'options.pskIdentityHint'); | ||
| 1242 | 1237 | } | |
| 1243 | 1238 | ||
| 1244 | 1239 | // constructor call | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,7 +18,6 @@ const { | |||
| 18 | 18 | const { | |
| 19 | 19 | ERR_ASYNC_CALLBACK, | |
| 20 | 20 | ERR_ASYNC_TYPE, | |
| 21 | - ERR_INVALID_ARG_TYPE, | ||
| 22 | 21 | ERR_INVALID_ASYNC_ID | |
| 23 | 22 | } = require('internal/errors').codes; | |
| 24 | 23 | const { kEmptyObject } = require('internal/util'); | |
@@ -280,10 +279,8 @@ class AsyncLocalStorage { | |||
| 280 | 279 | validateObject(options, 'options'); | |
| 281 | 280 | ||
| 282 | 281 | const { onPropagate = null } = options; | |
| 283 | - if (onPropagate !== null && typeof onPropagate !== 'function') { | ||
| 284 | - throw new ERR_INVALID_ARG_TYPE('options.onPropagate', | ||
| 285 | - 'function', | ||
| 286 | - onPropagate); | ||
| 282 | + if (onPropagate !== null) { | ||
| 283 | + validateFunction(onPropagate, 'options.onPropagate'); | ||
| 287 | 284 | } | |
| 288 | 285 | ||
| 289 | 286 | this.kResourceStore = Symbol('kResourceStore'); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments