@@ -331,6 +331,38 @@ const tests = [
331
331
. Cookie
332
332
. should . be . equal ( 'myCookie=myValue; mySecondCookie=mySecondValue' ) ;
333
333
}
334
+ } , {
335
+ description : 'should send programmatically set cookies correctly (DOWNLOAD) #57' ,
336
+ expected : 'resolved: {"content":{"cookies":{"myCookie":"myValue ...' ,
337
+ func : function ( resolve , reject ) {
338
+ var sourceUrl = 'http://httpbin.org/cookies' ;
339
+ var targetPath = cordova . file . cacheDirectory + 'cookies.json' ;
340
+
341
+ cordova . plugin . http . setCookie ( 'http://httpbin.org/get' , 'myCookie=myValue' ) ;
342
+ cordova . plugin . http . setCookie ( 'http://httpbin.org/get' , 'mySecondCookie=mySecondValue' ) ;
343
+
344
+ cordova . plugin . http . downloadFile ( sourceUrl , { } , { } , targetPath , function ( entry ) {
345
+ helpers . getWithXhr ( function ( content ) {
346
+ resolve ( {
347
+ sourceUrl : sourceUrl ,
348
+ targetPath : targetPath ,
349
+ fullPath : entry . fullPath ,
350
+ name : entry . name ,
351
+ content : content
352
+ } ) ;
353
+ } , targetPath ) ;
354
+ } , reject ) ;
355
+ } ,
356
+ validationFunc : function ( driver , result ) {
357
+ result . type . should . be . equal ( 'resolved' ) ;
358
+ result . data . name . should . be . equal ( 'cookies.json' ) ;
359
+ result . data . content . should . be . a ( 'string' ) ;
360
+
361
+ var cookies = JSON . parse ( result . data . content ) . cookies ;
362
+
363
+ cookies . myCookie . should . be . equal ( 'myValue' ) ;
364
+ cookies . mySecondCookie . should . be . equal ( 'mySecondValue' ) ;
365
+ }
334
366
}
335
367
] ;
336
368
0 commit comments