diff --git a/test/e2e-specs.js b/test/e2e-specs.js
index 4e1bcc9..36f4c7c 100644
--- a/test/e2e-specs.js
+++ b/test/e2e-specs.js
@@ -3,7 +3,7 @@ const hooks = {
cordova.plugin.http.clearCookies();
helpers.enableFollowingRedirect(function() {
- // server trust mode is not supported on brpwser platform
+ // server trust mode is not supported on browser platform
if (cordova.platformId === 'browser') {
return resolve();
}
@@ -787,7 +787,7 @@ const tests = [
},
{
description: 'should decode error body even if response type is "arraybuffer"',
- expected: 'rejected: {"status": 418, ...',
+ expected: 'rejected: {"status":418, ...',
func: function (resolve, reject) {
var url = 'https://httpbin.org/status/418';
var options = { method: 'get', responseType: 'arraybuffer' };
@@ -801,7 +801,7 @@ const tests = [
},
{
description: 'should serialize FormData instance correctly when it contains string value',
- expected: 'resolved: {"status": 200, ...',
+ expected: 'resolved: {"status":200, ...',
before: helpers.setMultipartSerializer,
func: function (resolve, reject) {
var ponyfills = cordova.plugin.http.ponyfills;
@@ -820,7 +820,7 @@ const tests = [
},
{
description: 'should serialize FormData instance correctly when it contains blob value',
- expected: 'resolved: {"status": 200, ...',
+ expected: 'resolved: {"status":200, ...',
before: helpers.setMultipartSerializer,
func: function (resolve, reject) {
var ponyfills = cordova.plugin.http.ponyfills;
@@ -890,6 +890,39 @@ const tests = [
result.data.headers['access-control-allow-origin'].should.be.equal('*');
}
},
+ {
+ description: 'should decode JSON data correctly when response type is "json" #301',
+ expected: 'resolved: {"status":200,"data":{"slideshow": ... ',
+ func: function (resolve, reject) {
+ var url = 'https://httpbin.org/json';
+ var options = { method: 'get', responseType: 'json' };
+ cordova.plugin.http.sendRequest(url, options, resolve, reject);
+ },
+ validationFunc: function (driver, result) {
+ result.type.should.be.equal('resolved');
+ result.data.status.should.be.equal(200);
+ result.data.data.should.be.an('object');
+ result.data.data.slideshow.should.be.eql({
+ author: 'Yours Truly',
+ date: 'date of publication',
+ slides: [
+ {
+ title: 'Wake up to WonderWidgets!',
+ type: 'all'
+ },
+ {
+ items: [
+ 'Why WonderWidgets are great',
+ 'Who buys WonderWidgets'
+ ],
+ title: 'Overview',
+ type: 'all'
+ }
+ ],
+ title: 'Sample Slide Show'
+ });
+ }
+ },
// TODO: not ready yet
// {