From d1a13bdd35e6a404b15d229fefdb361ac43a5d81 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sun, 13 Sep 2009 18:19:03 +0200 Subject: [PATCH] Fix default encoding for outgoing HTTP messages Was causing send() to throw argument errors because arrays of ints would get paired with the "raws" encoding. The bug was introduced in 8eb1294. --- src/http.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/http.js b/src/http.js index d3d71c7b22..3048c155b3 100644 --- a/src/http.js +++ b/src/http.js @@ -173,7 +173,8 @@ node.inherits(OutgoingMessage, node.EventEmitter); OutgoingMessage.prototype.send = function (data, encoding) { this.output.push(data); - this.outputEncodings.push(encoding || "raws"); + encoding = encoding || (data.constructor === Array ? "raw" : "raws"); + this.outputEncodings.push(encoding); }; OutgoingMessage.prototype.sendHeaderLines = function (first_line, headers) {