Skip to content

Commit 6050830

Browse files
authored
Merge pull request #389 from ath0mas/fix/344-redirect-specs
Resolve #344 restore and fix redirect specs
2 parents 95c9eb8 + 7e3ff25 commit 6050830

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ npm-debug.log
77
/temp
88
/android-sdk-macosx.zip
99
/android-sdk-macosx/**
10+
.idea/
11+
*.iml

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ This plugin uses amazing cloud services to maintain quality. CI Builds and E2E t
477477
* [BrowserStack](https://www.browserstack.com/)
478478
* [Sauce Labs](https://saucelabs.com/)
479479
* [httpbin.org](https://httpbin.org/)
480+
* [go-httpbin](https://httpbingo.org/)
480481

481482
### Local Testing
482483

test/e2e-specs.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -297,25 +297,25 @@ const tests = [
297297
JSON.parse(result.data.data).form.should.eql({ test: 'testString' });
298298
}
299299
},
300-
// {
301-
// description: 'should resolve correct URL after redirect (GET) #33',
302-
// expected: 'resolved: {"status": 200, url: "http://httpbin.org/anything", ...',
303-
// func: function (resolve, reject) { cordova.plugin.http.get('http://httpbin.org/redirect-to?url=http://httpbin.org/anything', {}, {}, resolve, reject); },
304-
// validationFunc: function (driver, result) {
305-
// result.type.should.be.equal('resolved');
306-
// result.data.url.should.be.equal('http://httpbin.org/anything');
307-
// }
308-
// },
309-
// {
310-
// description: 'should not follow 302 redirect when following redirects is disabled',
311-
// expected: 'rejected: {"status": 302, ...',
312-
// before: function (resolve, reject) { cordova.plugin.http.disableRedirect(true, resolve, reject) },
313-
// func: function (resolve, reject) { cordova.plugin.http.get('http://httpbin.org/redirect-to?url=http://httpbin.org/anything', {}, {}, resolve, reject); },
314-
// validationFunc: function (driver, result) {
315-
// result.type.should.be.equal('rejected');
316-
// result.data.status.should.be.equal(302);
317-
// }
318-
// },
300+
{
301+
description: 'should resolve correct URL after redirect (GET) #33',
302+
expected: 'resolved: {"status": 200, url: "http://httpbin.org/anything", ...',
303+
func: function (resolve, reject) { cordova.plugin.http.get('http://httpbingo.org/redirect-to?url=http://httpbin.org/anything', {}, {}, resolve, reject); },
304+
validationFunc: function (driver, result) {
305+
result.type.should.be.equal('resolved');
306+
result.data.url.should.be.equal('http://httpbin.org/anything');
307+
}
308+
},
309+
{
310+
description: 'should not follow 302 redirect when following redirects is disabled',
311+
expected: 'rejected: {"status": 302, ...',
312+
before: function (resolve, reject) { cordova.plugin.http.setFollowRedirect(false); resolve(); },
313+
func: function (resolve, reject) { cordova.plugin.http.get('http://httpbingo.org/redirect-to?url=http://httpbin.org/anything', {}, {}, resolve, reject); },
314+
validationFunc: function (driver, result) {
315+
result.type.should.be.equal('rejected');
316+
result.data.status.should.be.equal(302);
317+
}
318+
},
319319
{
320320
description: 'should download a file from given URL to given path in local filesystem',
321321
expected: 'resolved: {"content": "<?xml version=\'1.0\' encoding=\'us-ascii\'?>\\n\\n<!-- A SAMPLE set of slides -->" ...',

0 commit comments

Comments
 (0)