@@ -274,63 +274,59 @@ describe('$http', function() {
274
274
describe ( 'the instance' , function ( ) {
275
275
var $httpBackend , $http , $rootScope ;
276
276
277
- beforeEach ( inject ( [ '$rootScope' , function ( $rs ) {
278
- $rootScope = $rs ;
279
-
280
- spyOn ( $rootScope , '$apply' ) . andCallThrough ( ) ;
281
- } ] ) ) ;
282
-
283
- beforeEach ( inject ( [ '$httpBackend' , '$http' , function ( $hb , $h ) {
277
+ beforeEach ( inject ( [ '$httpBackend' , '$http' , '$rootScope' , function ( $hb , $h , $rs ) {
284
278
$httpBackend = $hb ;
285
279
$http = $h ;
280
+ $rootScope = $rs ;
281
+ spyOn ( $rootScope , '$apply' ) . andCallThrough ( ) ;
286
282
} ] ) ) ;
287
283
288
- it ( 'should throw error if the request configuration is not an object' , inject ( function ( $httpBackend , $http ) {
284
+ it ( 'should throw error if the request configuration is not an object' , function ( ) {
289
285
expect ( function ( ) {
290
286
$http ( '/url' ) ;
291
287
} ) . toThrowMinErr ( '$http' , 'badreq' , 'Http request configuration must be an object. Received: /url' ) ;
292
- } ) ) ;
288
+ } ) ;
293
289
294
- it ( 'should send GET requests if no method specified' , inject ( function ( $httpBackend , $http ) {
290
+ it ( 'should send GET requests if no method specified' , function ( ) {
295
291
$httpBackend . expect ( 'GET' , '/url' ) . respond ( '' ) ;
296
292
$http ( { url : '/url' } ) ;
297
- } ) ) ;
293
+ } ) ;
298
294
299
- it ( 'should do basic request' , inject ( function ( $httpBackend , $http ) {
295
+ it ( 'should do basic request' , function ( ) {
300
296
$httpBackend . expect ( 'GET' , '/url' ) . respond ( '' ) ;
301
297
$http ( { url : '/url' , method : 'GET' } ) ;
302
- } ) ) ;
298
+ } ) ;
303
299
304
300
305
- it ( 'should pass data if specified' , inject ( function ( $httpBackend , $http ) {
301
+ it ( 'should pass data if specified' , function ( ) {
306
302
$httpBackend . expect ( 'POST' , '/url' , 'some-data' ) . respond ( '' ) ;
307
303
$http ( { url : '/url' , method : 'POST' , data : 'some-data' } ) ;
308
- } ) ) ;
304
+ } ) ;
309
305
310
306
311
307
describe ( 'params' , function ( ) {
312
- it ( 'should do basic request with params and encode' , inject ( function ( $httpBackend , $http ) {
308
+ it ( 'should do basic request with params and encode' , function ( ) {
313
309
$httpBackend . expect ( 'GET' , '/url?a%3D=%3F%26&b=2' ) . respond ( '' ) ;
314
310
$http ( { url : '/url' , params : { 'a=' :'?&' , b :2 } , method : 'GET' } ) ;
315
- } ) ) ;
311
+ } ) ;
316
312
317
313
318
- it ( 'should merge params if url contains some already' , inject ( function ( $httpBackend , $http ) {
314
+ it ( 'should merge params if url contains some already' , function ( ) {
319
315
$httpBackend . expect ( 'GET' , '/url?c=3&a=1&b=2' ) . respond ( '' ) ;
320
316
$http ( { url : '/url?c=3' , params : { a :1 , b :2 } , method : 'GET' } ) ;
321
- } ) ) ;
317
+ } ) ;
322
318
323
319
324
- it ( 'should jsonify objects in params map' , inject ( function ( $httpBackend , $http ) {
320
+ it ( 'should jsonify objects in params map' , function ( ) {
325
321
$httpBackend . expect ( 'GET' , '/url?a=1&b=%7B%22c%22:3%7D' ) . respond ( '' ) ;
326
322
$http ( { url : '/url' , params : { a :1 , b :{ c :3 } } , method : 'GET' } ) ;
327
- } ) ) ;
323
+ } ) ;
328
324
329
325
330
- it ( 'should expand arrays in params map' , inject ( function ( $httpBackend , $http ) {
326
+ it ( 'should expand arrays in params map' , function ( ) {
331
327
$httpBackend . expect ( 'GET' , '/url?a=1&a=2&a=3' ) . respond ( '' ) ;
332
328
$http ( { url : '/url' , params : { a : [ 1 , 2 , 3 ] } , method : 'GET' } ) ;
333
- } ) ) ;
329
+ } ) ;
334
330
335
331
336
332
it ( 'should not encode @ in url params' , function ( ) {
@@ -763,7 +759,7 @@ describe('$http', function() {
763
759
$httpBackend . flush ( ) ;
764
760
} ) ) ;
765
761
766
- it ( 'should send execute result if header value is function' , inject ( function ( ) {
762
+ it ( 'should send execute result if header value is function' , function ( ) {
767
763
var headerConfig = { 'Accept' : function ( ) { return 'Rewritten' ; } } ;
768
764
769
765
function checkHeaders ( headers ) {
@@ -783,7 +779,7 @@ describe('$http', function() {
783
779
$http ( { url : '/url' , method : 'DELETE' , headers : headerConfig } ) ;
784
780
785
781
$httpBackend . flush ( ) ;
786
- } ) ) ;
782
+ } ) ;
787
783
788
784
it ( 'should check the cache before checking the XSRF cookie' , inject ( function ( $browser , $cacheFactory ) {
789
785
var testCache = $cacheFactory ( 'testCache' ) ,
0 commit comments