Browse Source

Use Array.isArray instead of instanceof

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
6a57a42109
  1. 4
      lib/http.js

4
lib/http.js

@ -359,7 +359,7 @@ OutgoingMessage.prototype._storeHeader = function (firstLine, headers) {
if (headers) { if (headers) {
var keys = Object.keys(headers); var keys = Object.keys(headers);
var isArray = (headers instanceof Array); var isArray = (Array.isArray(headers));
for (var i = 0, l = keys.length; i < l; i++) { for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i]; var key = keys[i];
if (isArray) { if (isArray) {
@ -1036,7 +1036,7 @@ exports.cat = function (url, encoding_, headers_) {
var url = require("url").parse(url); var url = require("url").parse(url);
var hasHost = false; var hasHost = false;
if (headers instanceof Array) { if (Array.isArray(headers)) {
for (var i = 0, l = headers.length; i < l; i++) { for (var i = 0, l = headers.length; i < l; i++) {
if (headers[i][0].toLowerCase() === 'host') { if (headers[i][0].toLowerCase() === 'host') {
hasHost = true; hasHost = true;

Loading…
Cancel
Save