@@ -3,7 +3,7 @@ const hooks = {
3
3
cordova . plugin . http . clearCookies ( ) ;
4
4
5
5
helpers . enableFollowingRedirect ( function ( ) {
6
- // server trust mode is not supported on brpwser platform
6
+ // server trust mode is not supported on browser platform
7
7
if ( cordova . platformId === 'browser' ) {
8
8
return resolve ( ) ;
9
9
}
@@ -787,7 +787,7 @@ const tests = [
787
787
} ,
788
788
{
789
789
description : 'should decode error body even if response type is "arraybuffer"' ,
790
- expected : 'rejected: {"status": 418, ...' ,
790
+ expected : 'rejected: {"status":418, ...' ,
791
791
func : function ( resolve , reject ) {
792
792
var url = 'https://httpbin.org/status/418' ;
793
793
var options = { method : 'get' , responseType : 'arraybuffer' } ;
@@ -801,7 +801,7 @@ const tests = [
801
801
} ,
802
802
{
803
803
description : 'should serialize FormData instance correctly when it contains string value' ,
804
- expected : 'resolved: {"status": 200, ...' ,
804
+ expected : 'resolved: {"status":200, ...' ,
805
805
before : helpers . setMultipartSerializer ,
806
806
func : function ( resolve , reject ) {
807
807
var ponyfills = cordova . plugin . http . ponyfills ;
@@ -820,7 +820,7 @@ const tests = [
820
820
} ,
821
821
{
822
822
description : 'should serialize FormData instance correctly when it contains blob value' ,
823
- expected : 'resolved: {"status": 200, ...' ,
823
+ expected : 'resolved: {"status":200, ...' ,
824
824
before : helpers . setMultipartSerializer ,
825
825
func : function ( resolve , reject ) {
826
826
var ponyfills = cordova . plugin . http . ponyfills ;
@@ -890,6 +890,39 @@ const tests = [
890
890
result . data . headers [ 'access-control-allow-origin' ] . should . be . equal ( '*' ) ;
891
891
}
892
892
} ,
893
+ {
894
+ description : 'should decode JSON data correctly when response type is "json" #301' ,
895
+ expected : 'resolved: {"status":200,"data":{"slideshow": ... ' ,
896
+ func : function ( resolve , reject ) {
897
+ var url = 'https://httpbin.org/json' ;
898
+ var options = { method : 'get' , responseType : 'json' } ;
899
+ cordova . plugin . http . sendRequest ( url , options , resolve , reject ) ;
900
+ } ,
901
+ validationFunc : function ( driver , result ) {
902
+ result . type . should . be . equal ( 'resolved' ) ;
903
+ result . data . status . should . be . equal ( 200 ) ;
904
+ result . data . data . should . be . an ( 'object' ) ;
905
+ result . data . data . slideshow . should . be . eql ( {
906
+ author : 'Yours Truly' ,
907
+ date : 'date of publication' ,
908
+ slides : [
909
+ {
910
+ title : 'Wake up to WonderWidgets!' ,
911
+ type : 'all'
912
+ } ,
913
+ {
914
+ items : [
915
+ 'Why <em>WonderWidgets</em> are great' ,
916
+ 'Who <em>buys</em> WonderWidgets'
917
+ ] ,
918
+ title : 'Overview' ,
919
+ type : 'all'
920
+ }
921
+ ] ,
922
+ title : 'Sample Slide Show'
923
+ } ) ;
924
+ }
925
+ } ,
893
926
894
927
// TODO: not ready yet
895
928
// {
0 commit comments