summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-05-12 12:15:58 -0700
committerRyan Dahl <ry@tinyclouds.org>2010-05-12 12:15:58 -0700
commitd0128787e74c36d589f00ac89ab17902dd8e0de0 (patch)
tree689f7b828107371958640905d824905a654119c2
parent7a2e6d674a94e01a17e856b4d51ec229fad9af51 (diff)
downloadnodejs-d0128787e74c36d589f00ac89ab17902dd8e0de0.tar.gz
nodejs-d0128787e74c36d589f00ac89ab17902dd8e0de0.tar.bz2
nodejs-d0128787e74c36d589f00ac89ab17902dd8e0de0.zip
Deprecate sendHeader() and writeHeader(), ppl should use writeHead()
-rw-r--r--lib/http.js28
1 files changed, 24 insertions, 4 deletions
diff --git a/lib/http.js b/lib/http.js
index 633bb86e9..352a05ed3 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -183,8 +183,15 @@ IncomingMessage.prototype._parseQueryString = function () {
throw new Error("_parseQueryString is deprecated. Use require(\"querystring\") to parse query strings.\n");
};
+var setBodyEncodingWarning;
+
IncomingMessage.prototype.setBodyEncoding = function (enc) {
- // TODO deprecation message?
+ // deprecation message
+ if (!setBodyEncodingWarning) {
+ setBodyEncodingWarning = "setBodyEncoding has been renamed to setEncoding, please update your code.";
+ sys.error(setBodyEncodingWarning);
+ }
+
this.setEncoding(enc);
};
@@ -446,9 +453,22 @@ ServerResponse.prototype.writeHead = function (statusCode) {
this.headWritten = true;
};
-// TODO eventually remove sendHeader(), writeHeader()
-ServerResponse.prototype.sendHeader = ServerResponse.prototype.writeHead;
-ServerResponse.prototype.writeHeader = ServerResponse.prototype.writeHead;
+// TODO Eventually remove
+var sendHeaderWarning, writeHeaderWarning;
+ServerResponse.prototype.sendHeader = function () {
+ if (!sendHeaderWarning) {
+ sendHeaderWarning = "sendHeader() has been renamed to writeHead()";
+ sys.error(sendHeaderWarning);
+ }
+ this.writeHead.apply(this, arguments);
+};
+ServerResponse.prototype.writeHeader = function () {
+ if (!writeHeaderWarning) {
+ writeHeaderWarning = "writeHeader() has been renamed to writeHead()";
+ sys.error(writeHeaderWarning);
+ }
+ this.writeHead.apply(this, arguments);
+};
function ClientRequest (socket, method, url, headers) {
OutgoingMessage.call(this, socket);