|
@ -548,14 +548,19 @@ node.http.Client.prototype.put = function (uri, headers) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.cat = function (url, encoding) { |
|
|
exports.cat = function (url, encoding, headers) { |
|
|
var promise = new node.Promise(); |
|
|
var promise = new node.Promise(); |
|
|
|
|
|
|
|
|
encoding = encoding || "utf8"; |
|
|
encoding = encoding || "utf8"; |
|
|
|
|
|
|
|
|
var uri = exports.parseUri(url); |
|
|
var uri = exports.parseUri(url); |
|
|
|
|
|
headers = headers || {}; |
|
|
|
|
|
if (!headers["Host"] && uri.host) { |
|
|
|
|
|
headers["Host"] = uri.host; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var client = exports.createClient(uri.port || 80, uri.host); |
|
|
var client = exports.createClient(uri.port || 80, uri.host); |
|
|
var req = client.get(uri.path || "/", uri.host ? {"Host" : uri.host} : {}); |
|
|
var req = client.get(uri.path || "/", headers); |
|
|
|
|
|
|
|
|
client.addListener("error", function () { |
|
|
client.addListener("error", function () { |
|
|
promise.emitError(); |
|
|
promise.emitError(); |
|
|