diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 67a8d6f8bb8233..bf018d988d7abb 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -382,8 +382,8 @@ OutgoingMessage.prototype.setHeader = function setHeader(name, value) { OutgoingMessage.prototype.getHeader = function getHeader(name) { - if (arguments.length < 1) { - throw new Error('"name" argument is required for getHeader(name)'); + if (typeof name !== 'string') { + throw new TypeError('"name" argument must be a string'); } if (!this._headers) return; @@ -393,8 +393,8 @@ OutgoingMessage.prototype.getHeader = function getHeader(name) { OutgoingMessage.prototype.removeHeader = function removeHeader(name) { - if (arguments.length < 1) { - throw new Error('"name" argument is required for removeHeader(name)'); + if (typeof name !== 'string') { + throw new TypeError('"name" argument must be a string'); } if (this._header) {