Remove deprecation warnings in http module
This commit is contained in:
parent
f08985c193
commit
a63fd0fe56
53
lib/http.js
53
lib/http.js
@ -202,17 +202,6 @@ IncomingMessage.prototype._parseQueryString = function () {
|
|||||||
throw new Error("_parseQueryString is deprecated. Use require(\"querystring\") to parse query strings.\n");
|
throw new Error("_parseQueryString is deprecated. Use require(\"querystring\") to parse query strings.\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
var setBodyEncodingWarning;
|
|
||||||
|
|
||||||
IncomingMessage.prototype.setBodyEncoding = function (enc) {
|
|
||||||
// deprecation message
|
|
||||||
if (!setBodyEncodingWarning) {
|
|
||||||
setBodyEncodingWarning = "setBodyEncoding has been renamed to setEncoding, please update your code.";
|
|
||||||
sys.error(setBodyEncodingWarning);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setEncoding(enc);
|
|
||||||
};
|
|
||||||
|
|
||||||
IncomingMessage.prototype.setEncoding = function (encoding) {
|
IncomingMessage.prototype.setEncoding = function (encoding) {
|
||||||
var StringDecoder = require("string_decoder").StringDecoder; // lazy load
|
var StringDecoder = require("string_decoder").StringDecoder; // lazy load
|
||||||
@ -518,20 +507,6 @@ OutgoingMessage.prototype.addTrailers = function (headers) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
OutgoingMessage.prototype.finish = function () {
|
|
||||||
throw new Error("finish() has been renamed to close().");
|
|
||||||
};
|
|
||||||
|
|
||||||
var closeWarning;
|
|
||||||
|
|
||||||
OutgoingMessage.prototype.close = function (data, encoding) {
|
|
||||||
if (!closeWarning) {
|
|
||||||
closeWarning = "OutgoingMessage.prototype.close has been renamed to end()";
|
|
||||||
sys.error(closeWarning);
|
|
||||||
}
|
|
||||||
return this.end(data, encoding);
|
|
||||||
};
|
|
||||||
|
|
||||||
OutgoingMessage.prototype.end = function (data, encoding) {
|
OutgoingMessage.prototype.end = function (data, encoding) {
|
||||||
var ret;
|
var ret;
|
||||||
|
|
||||||
@ -639,20 +614,8 @@ ServerResponse.prototype.writeHead = function (statusCode) {
|
|||||||
this._storeHeader(statusLine, headers);
|
this._storeHeader(statusLine, headers);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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 () {
|
ServerResponse.prototype.writeHeader = function () {
|
||||||
if (!writeHeaderWarning) {
|
|
||||||
writeHeaderWarning = "writeHeader() has been renamed to writeHead()";
|
|
||||||
sys.error(writeHeaderWarning);
|
|
||||||
}
|
|
||||||
this.writeHead.apply(this, arguments);
|
this.writeHead.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -680,20 +643,6 @@ ClientRequest.prototype.finish = function () {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
var clientRequestCloseWarning;
|
|
||||||
|
|
||||||
ClientRequest.prototype.close = function () {
|
|
||||||
if (!clientRequestCloseWarning) {
|
|
||||||
clientRequestCloseWarning = "Warning: ClientRequest.prototype.close has been renamed to end()";
|
|
||||||
sys.error(clientRequestCloseWarning);
|
|
||||||
}
|
|
||||||
if (typeof arguments[0] == "function") {
|
|
||||||
throw new Error( "ClientRequest.prototype.end does not take a callback. "
|
|
||||||
+ "Add a 'response' listener manually to the request object."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return this.end();
|
|
||||||
};
|
|
||||||
|
|
||||||
ClientRequest.prototype.end = function () {
|
ClientRequest.prototype.end = function () {
|
||||||
if (typeof arguments[0] == "function") {
|
if (typeof arguments[0] == "function") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user