This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -918,6 +918,10 @@ function $HttpProvider() {
918
918
throw minErr ( '$http' ) ( 'badreq' , 'Http request configuration must be an object. Received: {0}' , requestConfig ) ;
919
919
}
920
920
921
+ if ( ! isString ( requestConfig . url ) ) {
922
+ throw minErr ( '$http' ) ( 'badreq' , 'Http request configuration url must be a string. Received: {0}' , requestConfig . url ) ;
923
+ }
924
+
921
925
var config = extend ( {
922
926
method : 'get' ,
923
927
transformRequest : defaults . transformRequest ,
Original file line number Diff line number Diff line change @@ -302,6 +302,13 @@ describe('$http', function() {
302
302
} ) . toThrowMinErr ( '$http' , 'badreq' , 'Http request configuration must be an object. Received: /url' ) ;
303
303
} ) ;
304
304
305
+ it ( 'should throw error if the request configuration url is not a string' , function ( ) {
306
+ expect ( function ( ) {
307
+ $http ( { url : false } ) ;
308
+ } ) . toThrowMinErr ( '$http' , 'badreq' , 'Http request configuration url must be a string. Received: false' ) ;
309
+ } ) ;
310
+
311
+
305
312
it ( 'should send GET requests if no method specified' , function ( ) {
306
313
$httpBackend . expect ( 'GET' , '/url' ) . respond ( '' ) ;
307
314
$http ( { url : '/url' } ) ;
You can’t perform that action at this time.
0 commit comments