Skip to content

Commit

Permalink
http: revert deprecation of client property
Browse files Browse the repository at this point in the history
Reason: breaks a feature in the request module
  • Loading branch information
targos committed May 31, 2015
1 parent 5d83401 commit 26547fe
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/_http_incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ function readStop(socket) {
}
exports.readStop = readStop;

const deprecatedClientProperty = {
configurable: true,
enumerable: true,
get: util.deprecate(function() {
return this.socket;
}, 'client is deprecated, use socket instead'),
set: util.deprecate(function(val) {
this.socket = val;
}, 'client is deprecated, use socket instead')
};

/* Abstract base class for ServerRequest and ClientResponse. */
function IncomingMessage(socket) {
Expand Down Expand Up @@ -47,7 +57,7 @@ function IncomingMessage(socket) {
// response (client) only
this.statusCode = null;
this.statusMessage = null;
this._client = socket; // deprecated
Object.defineProperty(this, 'client', deprecatedClientProperty);

// flag for backwards compatibility grossness.
this._consuming = false;
Expand All @@ -61,16 +71,6 @@ util.inherits(IncomingMessage, Stream.Readable);

exports.IncomingMessage = IncomingMessage;

Object.defineProperty(IncomingMessage.prototype, 'client', {
configurable: true,
enumerable: true,
get: util.deprecate(function() {
return this._client;
}, 'client is deprecated, use socket or connection instead'),
set: util.deprecate(function(val) {
this._client = val;
}, 'client is deprecated, use socket or connection instead')
});

IncomingMessage.prototype.setTimeout = function(msecs, callback) {
if (callback)
Expand Down

0 comments on commit 26547fe

Please sign in to comment.