From 35109ddaf254137ab11383fddd1a00a7f1b77916 Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Sat, 30 Jul 2016 20:44:23 +0200 Subject: [PATCH] lib: remove double check of string type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit checkIsHttpToken() already checks for typeof string. We do not want to check twice. PR-URL: https://github.com/nodejs/node/pull/7985 Reviewed-By: Ben Noordhuis Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Johan Bergström Reviewed-By: Brian White Reviewed-By: James M Snell --- lib/_http_outgoing.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 8214826db8..c5c294a1b3 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -338,8 +338,6 @@ OutgoingMessage.prototype.setHeader = function(name, value) { if (!common._checkIsHttpToken(name)) throw new TypeError( 'Header name must be a valid HTTP Token ["' + name + '"]'); - if (typeof name !== 'string') - throw new TypeError('"name" should be a string in setHeader(name, value)'); if (value === undefined) throw new Error('"value" required in setHeader("' + name + '", value)'); if (this._header)