@@ -119,7 +119,7 @@ describe('lib/http-proxy.js', function() {
119
119
target : 'http://127.0.0.1:8080'
120
120
} ) ;
121
121
122
- proxy . ee . on ( 'http-proxy:outgoing:web: error' , function ( err ) {
122
+ proxy . on ( 'error' , function ( err ) {
123
123
expect ( err ) . to . be . an ( Error ) ;
124
124
expect ( err . code ) . to . be ( 'ECONNREFUSED' ) ;
125
125
proxyServer . _server . close ( ) ;
@@ -136,50 +136,50 @@ describe('lib/http-proxy.js', function() {
136
136
} ) ;
137
137
} ) ;
138
138
139
- describe ( '#createProxyServer using the web-incoming passes' , function ( ) {
140
- it ( 'should emit events correclty' , function ( done ) {
141
- var proxy = httpProxy . createProxyServer ( {
142
- target : 'http://127.0.0.1:8080'
143
- } ) ,
139
+ // describe('#createProxyServer using the web-incoming passes', function () {
140
+ // it('should emit events correclty', function(done) {
141
+ // var proxy = httpProxy.createProxyServer({
142
+ // target: 'http://127.0.0.1:8080'
143
+ // }),
144
144
145
- proxyServer = proxy . listen ( '8081' ) ,
145
+ // proxyServer = proxy.listen('8081'),
146
146
147
- source = http . createServer ( function ( req , res ) {
148
- expect ( req . method ) . to . eql ( 'GET' ) ;
149
- expect ( req . headers . host . split ( ':' ) [ 1 ] ) . to . eql ( '8081' ) ;
150
- res . writeHead ( 200 , { 'Content-Type' : 'text/plain' } )
151
- res . end ( 'Hello from ' + source . address ( ) . port ) ;
152
- } ) ,
147
+ // source = http.createServer(function(req, res) {
148
+ // expect(req.method).to.eql('GET');
149
+ // expect(req.headers.host.split(':')[1]).to.eql('8081');
150
+ // res.writeHead(200, {'Content-Type': 'text/plain'})
151
+ // res.end('Hello from ' + source.address().port);
152
+ // }),
153
153
154
- events = [ ] ;
154
+ // events = [];
155
155
156
- source . listen ( '8080' ) ;
156
+ // source.listen('8080');
157
157
158
- proxy . ee . on ( 'http-proxy:**' , function ( uno , dos , tres ) {
159
- events . push ( this . event ) ;
160
- } )
158
+ // proxy.ee.on('http-proxy:**', function (uno, dos, tres) {
159
+ // events.push(this.event);
160
+ // })
161
161
162
- http . request ( {
163
- hostname : '127.0.0.1' ,
164
- port : '8081' ,
165
- method : 'GET' ,
166
- } , function ( res ) {
167
- expect ( res . statusCode ) . to . eql ( 200 ) ;
168
-
169
- res . on ( 'data' , function ( data ) {
170
- expect ( data . toString ( ) ) . to . eql ( 'Hello from 8080' ) ;
171
- } ) ;
172
-
173
- res . on ( 'end' , function ( ) {
174
- expect ( events ) . to . contain ( 'http-proxy:outgoing:web:begin' ) ;
175
- expect ( events ) . to . contain ( 'http-proxy:outgoing:web:end' ) ;
176
- source . close ( ) ;
177
- proxyServer . _server . close ( ) ;
178
- done ( ) ;
179
- } ) ;
180
- } ) . end ( ) ;
181
- } ) ;
182
- } ) ;
162
+ // http.request({
163
+ // hostname: '127.0.0.1',
164
+ // port: '8081',
165
+ // method: 'GET',
166
+ // }, function(res) {
167
+ // expect(res.statusCode).to.eql(200);
168
+
169
+ // res.on('data', function (data) {
170
+ // expect(data.toString()).to.eql('Hello from 8080');
171
+ // });
172
+
173
+ // res.on('end', function () {
174
+ // expect(events).to.contain('http-proxy:outgoing:web:begin');
175
+ // expect(events).to.contain('http-proxy:outgoing:web:end');
176
+ // source.close();
177
+ // proxyServer._server.close();
178
+ // done();
179
+ // });
180
+ // }).end();
181
+ // });
182
+ // });
183
183
184
184
describe ( '#createProxyServer using the ws-incoming passes' , function ( ) {
185
185
it ( 'should proxy the websockets stream' , function ( done ) {
0 commit comments