Skip to content

Commit a63fd0f

Browse files
committed
Remove deprecation warnings in http module
1 parent f08985c commit a63fd0f

1 file changed

Lines changed: 1 addition & 52 deletions

File tree

lib/http.js

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,6 @@ IncomingMessage.prototype._parseQueryString = function () {
202202
throw new Error("_parseQueryString is deprecated. Use require(\"querystring\") to parse query strings.\n");
203203
};
204204

205-
var setBodyEncodingWarning;
206-
207-
IncomingMessage.prototype.setBodyEncoding = function (enc) {
208-
// deprecation message
209-
if (!setBodyEncodingWarning) {
210-
setBodyEncodingWarning = "setBodyEncoding has been renamed to setEncoding, please update your code.";
211-
sys.error(setBodyEncodingWarning);
212-
}
213-
214-
this.setEncoding(enc);
215-
};
216205

217206
IncomingMessage.prototype.setEncoding = function (encoding) {
218207
var StringDecoder = require("string_decoder").StringDecoder; // lazy load
@@ -518,20 +507,6 @@ OutgoingMessage.prototype.addTrailers = function (headers) {
518507
};
519508

520509

521-
OutgoingMessage.prototype.finish = function () {
522-
throw new Error("finish() has been renamed to close().");
523-
};
524-
525-
var closeWarning;
526-
527-
OutgoingMessage.prototype.close = function (data, encoding) {
528-
if (!closeWarning) {
529-
closeWarning = "OutgoingMessage.prototype.close has been renamed to end()";
530-
sys.error(closeWarning);
531-
}
532-
return this.end(data, encoding);
533-
};
534-
535510
OutgoingMessage.prototype.end = function (data, encoding) {
536511
var ret;
537512

@@ -639,20 +614,8 @@ ServerResponse.prototype.writeHead = function (statusCode) {
639614
this._storeHeader(statusLine, headers);
640615
};
641616

642-
// TODO Eventually remove
643-
var sendHeaderWarning, writeHeaderWarning;
644-
ServerResponse.prototype.sendHeader = function () {
645-
if (!sendHeaderWarning) {
646-
sendHeaderWarning = "sendHeader() has been renamed to writeHead()";
647-
sys.error(sendHeaderWarning);
648-
}
649-
this.writeHead.apply(this, arguments);
650-
};
617+
651618
ServerResponse.prototype.writeHeader = function () {
652-
if (!writeHeaderWarning) {
653-
writeHeaderWarning = "writeHeader() has been renamed to writeHead()";
654-
sys.error(writeHeaderWarning);
655-
}
656619
this.writeHead.apply(this, arguments);
657620
};
658621

@@ -680,20 +643,6 @@ ClientRequest.prototype.finish = function () {
680643
);
681644
};
682645

683-
var clientRequestCloseWarning;
684-
685-
ClientRequest.prototype.close = function () {
686-
if (!clientRequestCloseWarning) {
687-
clientRequestCloseWarning = "Warning: ClientRequest.prototype.close has been renamed to end()";
688-
sys.error(clientRequestCloseWarning);
689-
}
690-
if (typeof arguments[0] == "function") {
691-
throw new Error( "ClientRequest.prototype.end does not take a callback. "
692-
+ "Add a 'response' listener manually to the request object."
693-
);
694-
}
695-
return this.end();
696-
};
697646

698647
ClientRequest.prototype.end = function () {
699648
if (typeof arguments[0] == "function") {

0 commit comments

Comments
 (0)