@@ -15,6 +15,16 @@ function readStop(socket) {
1515}
1616exports . readStop = readStop ;
1717
18+ const deprecatedClientProperty = {
19+ configurable : true ,
20+ enumerable : true ,
21+ get : util . deprecate ( function ( ) {
22+ return this . socket ;
23+ } , 'http.IncomingRequest.client is deprecated, use .socket instead' ) ,
24+ set : util . deprecate ( function ( val ) {
25+ this . socket = val ;
26+ } , 'http.IncomingRequest.client is deprecated, use .socket instead' )
27+ } ;
1828
1929/* Abstract base class for ServerRequest and ClientResponse. */
2030function IncomingMessage ( socket ) {
@@ -47,7 +57,7 @@ function IncomingMessage(socket) {
4757 // response (client) only
4858 this . statusCode = null ;
4959 this . statusMessage = null ;
50- this . _client = socket ; // deprecated
60+ Object . defineProperty ( this , 'client' , deprecatedClientProperty ) ;
5161
5262 // flag for backwards compatibility grossness.
5363 this . _consuming = false ;
@@ -61,16 +71,6 @@ util.inherits(IncomingMessage, Stream.Readable);
6171
6272exports . IncomingMessage = IncomingMessage ;
6373
64- Object . defineProperty ( IncomingMessage . prototype , 'client' , {
65- configurable : true ,
66- enumerable : true ,
67- get : util . deprecate ( function ( ) {
68- return this . _client ;
69- } , 'client is deprecated, use socket or connection instead' ) ,
70- set : util . deprecate ( function ( val ) {
71- this . _client = val ;
72- } , 'client is deprecated, use socket or connection instead' )
73- } ) ;
7474
7575IncomingMessage . prototype . setTimeout = function ( msecs , callback ) {
7676 if ( callback )
0 commit comments