mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2024-10-06 09:12:13 +08:00
chore: auto fix some indentations
This commit is contained in:
parent
fcedfae1ac
commit
6a60058fc6
@ -407,9 +407,9 @@ cordova.plugin.http.downloadFile("https://google.com/", {
|
||||
### abort<a name="abort"></a>
|
||||
Abort a HTTP request. Takes the `requestId` which is returned by [sendRequest](#sendRequest) and its shorthand functions ([post](#post), [get](#get), [put](#put), [patch](#patch), [delete](#delete), [head](#head), [uploadFile](#uploadFile) and [downloadFile](#downloadFile)).
|
||||
|
||||
If the request already has finished, the request will finish normally and the abort call result will be `{aborted: false}`.
|
||||
If the request already has finished, the request will finish normally and the abort call result will be `{ aborted: false }`.
|
||||
|
||||
If the request is still in progress, the request's `failure` callback will be invoked with response `{status: -8}`, and the abort call result `{aborted: true}`.
|
||||
If the request is still in progress, the request's `failure` callback will be invoked with response `{ status: -8 }`, and the abort call result `{ aborted: true }`.
|
||||
|
||||
:warning: Not supported for Android < 6 (API level < 23). For Android 5.1 and below, calling `abort(reqestId)` will have no effect, i.e. the requests will finish as if the request was not cancelled.
|
||||
|
||||
|
@ -85,8 +85,8 @@ const helpers = {
|
||||
result.type.should.be.equal(expected);
|
||||
},
|
||||
isAbortSupported: function () {
|
||||
if(window.cordova && window.cordova.platformId === 'android'){
|
||||
var version = device.version;//NOTE will throw error if cordova is present without cordova-plugin-device
|
||||
if (window.cordova && window.cordova.platformId === 'android') {
|
||||
var version = device.version; //NOTE will throw error if cordova is present without cordova-plugin-device
|
||||
var major = parseInt(/^(\d+)(\.|$)/.exec(version)[1], 10);
|
||||
return isFinite(major) && major >= 6;
|
||||
}
|
||||
@ -1009,7 +1009,7 @@ const tests = [
|
||||
helpers.getWithXhr(function (buffer) {
|
||||
var reqId = cordova.plugin.http.post('http://httpbin.org/anything', buffer, {}, resolve, reject);
|
||||
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
cordova.plugin.http.abort(reqId);
|
||||
}, helpers.getAbortDelay());
|
||||
|
||||
@ -1039,7 +1039,7 @@ const tests = [
|
||||
};
|
||||
|
||||
var reqId = cordova.plugin.http.sendRequest(url, options, success, reject);
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
cordova.plugin.http.abort(reqId);
|
||||
}, helpers.getAbortDelay());
|
||||
},
|
||||
@ -1071,14 +1071,14 @@ const tests = [
|
||||
}, targetPath);
|
||||
}, reject);
|
||||
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
cordova.plugin.http.abort(reqId);
|
||||
}, helpers.getAbortDelay());
|
||||
|
||||
},
|
||||
validationFunc: function (driver, result) {
|
||||
helpers.checkResult(result, 'rejected');
|
||||
result.data.status.should.be.equal(-8);
|
||||
helpers.checkResult(result, 'rejected');
|
||||
result.data.status.should.be.equal(-8);
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -1098,15 +1098,15 @@ const tests = [
|
||||
|
||||
var reqId = cordova.plugin.http.uploadFile(targetUrl, {}, {}, sourcePath, fileName, resolve, reject);
|
||||
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
cordova.plugin.http.abort(reqId);
|
||||
}, helpers.getAbortDelay());
|
||||
|
||||
}, fileName, fileContent);
|
||||
},
|
||||
validationFunc: function (driver, result) {
|
||||
helpers.checkResult(result, 'rejected');
|
||||
result.data.status.should.be.equal(-8);
|
||||
helpers.checkResult(result, 'rejected');
|
||||
result.data.status.should.be.equal(-8);
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -49,13 +49,15 @@ describe('Advanced HTTP e2e test suite', function () {
|
||||
});
|
||||
|
||||
const defineTestForMocha = (test, index) => {
|
||||
it(index + ': ' + test.description, async function() {
|
||||
it(index + ': ' + test.description, async function () {
|
||||
await clickNext(driver);
|
||||
await validateTestIndex(driver, index);
|
||||
await validateTestTitle(driver, test.description);
|
||||
await waitToBeFinished(driver, test.timeout || 10000);
|
||||
|
||||
const skipped = await checkSkipped(driver);
|
||||
if(skipped){
|
||||
|
||||
if (skipped) {
|
||||
this.skip();
|
||||
} else {
|
||||
await validateResult(driver, test.validationFunc, targetInfo);
|
||||
|
Loading…
Reference in New Issue
Block a user