@@ -43,7 +43,8 @@ describe('Proxy', function () {
43
43
{ method : 'POST' , path : '/item' , config : { proxy : { host : '127.0.0.1' , port : 18093 } } } ,
44
44
{ method : 'POST' , path : '/notfound' , config : { proxy : { host : '127.0.0.1' , port : 18093 } } } ,
45
45
{ method : 'GET' , path : '/postResponseError' , config : { proxy : { host : '127.0.0.1' , port : 18093 , postResponse : postResponseWithError } , cache : routeCache } } ,
46
- { method : 'POST' , path : '/echo' , config : { proxy : { mapUri : mapUri } } }
46
+ { method : 'POST' , path : '/echo' , config : { proxy : { mapUri : mapUri } } } ,
47
+ { method : 'GET' , path : '/maperror' , config : { proxy : { mapUri : mapUriWithError } } }
47
48
] ) ;
48
49
49
50
dummyServer . listener . on ( 'listening' , function ( ) {
@@ -72,6 +73,11 @@ describe('Proxy', function () {
72
73
return callback ( null , 'http://127.0.0.1:18093' + request . path , request . query ) ;
73
74
}
74
75
76
+ function mapUriWithError ( request , callback ) {
77
+
78
+ return callback ( new Error ( 'myerror' ) ) ;
79
+ }
80
+
75
81
function profile ( request ) {
76
82
77
83
request . reply ( {
@@ -209,4 +215,13 @@ describe('Proxy', function () {
209
215
done ( ) ;
210
216
} ) ;
211
217
} ) ;
218
+
219
+ it ( 'replies with an error when it occurs in mapUri' , function ( done ) {
220
+
221
+ makeRequest ( { path : '/maperror' , method : 'get' } , function ( rawRes ) {
222
+
223
+ expect ( rawRes . body ) . to . contain ( 'myerror' ) ;
224
+ done ( ) ;
225
+ } ) ;
226
+ } ) ;
212
227
} ) ;
0 commit comments