File tree 2 files changed +5
-12
lines changed
2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,7 @@ exports = module.exports = function backend() {
10
10
11
11
var XRegExp = require ( "xregexp" ) . XRegExp ;
12
12
var httpProxy = require ( "http-proxy" ) ;
13
- var BASE_CONFIG = { target : { "protocol" : "HTTP" } } ;
14
- var proxy = new httpProxy . createProxyServer ( BASE_CONFIG ) ;
13
+ var proxy = new httpProxy . RoutingProxy ( ) ;
15
14
16
15
var options = Array . prototype . map . call ( arguments , function ( option ) {
17
16
[ REGEXP , PROXY ] . forEach ( function ( property ) {
@@ -25,11 +24,6 @@ exports = module.exports = function backend() {
25
24
return option ;
26
25
} ) ;
27
26
28
- proxy . on ( "error" , function ( err , req , res ) {
29
- res . writeHead ( 500 , { 'Content-Type' : 'text/plain' } ) ;
30
- res . end ( err ) ;
31
- } ) ;
32
-
33
27
function copy ( source ) {
34
28
var target ;
35
29
@@ -91,8 +85,7 @@ exports = module.exports = function backend() {
91
85
92
86
if ( matches ) {
93
87
option = transform ( copy ( option ) , matches ) ;
94
-
95
- proxy . web ( request , response , { target : option [ PROXY ] } ) ;
88
+ proxy . proxyRequest ( request , response , option [ PROXY ] [ "target" ] ) ;
96
89
97
90
return true ;
98
91
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " devserver" ,
3
- "version" : " 0.2.4 " ,
3
+ "version" : " 0.2.5 " ,
4
4
"description" : " Simple local development server" ,
5
5
"author" : {
6
6
"name" : " Mikael Karon" ,
17
17
"dependencies" : {
18
18
"connect" : " ~2" ,
19
19
"cli" : " ~0" ,
20
- "http-proxy" : " ~1 " ,
20
+ "http-proxy" : " ~0 " ,
21
21
"pause" : " ~0" ,
22
22
"send" : " ~0" ,
23
23
"xregexp" : " ~2"
35
35
"scripts" : {
36
36
"test" : " grunt test"
37
37
}
38
- }
38
+ }
You can’t perform that action at this time.
0 commit comments