Browse Source

lib: remove double check of string type

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 <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
v7.x
Franziska Hinkelmann 9 years ago
committed by James M Snell
parent
commit
35109ddaf2
  1. 2
      lib/_http_outgoing.js

2
lib/_http_outgoing.js

@ -338,8 +338,6 @@ OutgoingMessage.prototype.setHeader = function(name, value) {
if (!common._checkIsHttpToken(name)) if (!common._checkIsHttpToken(name))
throw new TypeError( throw new TypeError(
'Header name must be a valid HTTP Token ["' + name + '"]'); '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) if (value === undefined)
throw new Error('"value" required in setHeader("' + name + '", value)'); throw new Error('"value" required in setHeader("' + name + '", value)');
if (this._header) if (this._header)

Loading…
Cancel
Save