@@ -78,14 +78,14 @@ describe('lib/http-proxy.js', function() {
78
78
} ) ;
79
79
80
80
source . listen ( ports . source ) ;
81
-
81
+
82
82
http . request ( {
83
83
hostname : '127.0.0.1' ,
84
84
port : ports . proxy ,
85
85
method : 'POST' ,
86
86
headers : {
87
87
'x-forwarded-for' : '127.0.0.1'
88
- }
88
+ }
89
89
} , function ( ) { } ) . end ( ) ;
90
90
} ) ;
91
91
} ) ;
@@ -105,7 +105,7 @@ describe('lib/http-proxy.js', function() {
105
105
} ) ;
106
106
107
107
source . listen ( ports . source ) ;
108
-
108
+
109
109
http . request ( {
110
110
hostname : '127.0.0.1' ,
111
111
port : ports . proxy ,
@@ -117,7 +117,7 @@ describe('lib/http-proxy.js', function() {
117
117
expect ( data . toString ( ) ) . to . eql ( 'Hello from ' + ports . source ) ;
118
118
} ) ;
119
119
120
- res . on ( 'end' , function ( ) {
120
+ res . on ( 'end' , function ( ) {
121
121
source . close ( ) ;
122
122
proxy . _server . close ( ) ;
123
123
done ( ) ;
@@ -141,7 +141,7 @@ describe('lib/http-proxy.js', function() {
141
141
} )
142
142
143
143
proxy . listen ( ports . proxy ) ;
144
-
144
+
145
145
http . request ( {
146
146
hostname : '127.0.0.1' ,
147
147
port : ports . proxy ,
@@ -159,6 +159,11 @@ describe('lib/http-proxy.js', function() {
159
159
timeout : 3
160
160
} ) . listen ( ports . proxy ) ;
161
161
162
+ proxy . on ( 'error' , function ( e ) {
163
+ expect ( e ) . to . be . an ( Error ) ;
164
+ expect ( e . code ) . to . be . eql ( 'ECONNRESET' ) ;
165
+ } ) ;
166
+
162
167
var source = http . createServer ( function ( req , res ) {
163
168
setTimeout ( function ( ) {
164
169
res . end ( 'At this point the socket should be closed' ) ;
@@ -207,7 +212,7 @@ describe('lib/http-proxy.js', function() {
207
212
// proxy.ee.on('http-proxy:**', function (uno, dos, tres) {
208
213
// events.push(this.event);
209
214
// })
210
-
215
+
211
216
// http.request({
212
217
// hostname: '127.0.0.1',
213
218
// port: '8081',
@@ -314,4 +319,4 @@ describe('lib/http-proxy.js', function() {
314
319
} )
315
320
} ) ;
316
321
} )
317
- } ) ;
322
+ } ) ;
0 commit comments