Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 3 additions & 4 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,10 @@ function ClientRequest(input, options, cb) {
this.maxHeaderSize = maxHeaderSize;

const insecureHTTPParser = options.insecureHTTPParser;
if (insecureHTTPParser !== undefined &&
typeof insecureHTTPParser !== 'boolean') {
throw new ERR_INVALID_ARG_TYPE(
'options.insecureHTTPParser', 'boolean', insecureHTTPParser);
if (insecureHTTPParser !== undefined) {
validateBoolean(insecureHTTPParser, 'options.insecureHTTPParser');
}

this.insecureHTTPParser = insecureHTTPParser;

if (options.joinDuplicateHeaders !== undefined) {
Expand Down
19 changes: 7 additions & 12 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1224,21 +1224,16 @@ function Server(options, listener) {

validateNumber(this[kHandshakeTimeout], 'options.handshakeTimeout');

if (this[kSNICallback] && typeof this[kSNICallback] !== 'function') {
throw new ERR_INVALID_ARG_TYPE(
'options.SNICallback', 'function', options.SNICallback);
if (this[kSNICallback]) {
validateFunction(this[kSNICallback], 'options.SNICallback');
}

if (this[kPskCallback] && typeof this[kPskCallback] !== 'function') {
throw new ERR_INVALID_ARG_TYPE(
'options.pskCallback', 'function', options.pskCallback);
if (this[kPskCallback]) {
validateFunction(this[kPskCallback], 'options.pskCallback');
}
if (this[kPskIdentityHint] && typeof this[kPskIdentityHint] !== 'string') {
throw new ERR_INVALID_ARG_TYPE(
'options.pskIdentityHint',
'string',
options.pskIdentityHint
);

if (this[kPskIdentityHint]) {
validateString(this[kPskIdentityHint], 'options.pskIdentityHint');
}

// constructor call
Expand Down
7 changes: 2 additions & 5 deletions lib/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const {
const {
ERR_ASYNC_CALLBACK,
ERR_ASYNC_TYPE,
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ASYNC_ID
} = require('internal/errors').codes;
const { kEmptyObject } = require('internal/util');
Expand Down Expand Up @@ -280,10 +279,8 @@ class AsyncLocalStorage {
validateObject(options, 'options');

const { onPropagate = null } = options;
if (onPropagate !== null && typeof onPropagate !== 'function') {
throw new ERR_INVALID_ARG_TYPE('options.onPropagate',
'function',
onPropagate);
if (onPropagate !== null) {
validateFunction(onPropagate, 'options.onPropagate');
}

this.kResourceStore = Symbol('kResourceStore');
Expand Down