chore: update all dependencies

This commit is contained in:
Sefa Ilkimen 2022-03-30 23:14:37 +02:00
parent 9870dde50a
commit c92f07775b
No known key found for this signature in database
GPG Key ID: 4AB0B60A9B5E59F5
4 changed files with 3419 additions and 3967 deletions

7281
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -58,11 +58,11 @@
},
"homepage": "https://github.com/silkimen/cordova-plugin-advanced-http#readme",
"devDependencies": {
"chai": "4.2.0",
"chai": "4.3.6",
"colors": "1.4.0",
"cordova": "10.0.0",
"mocha": "8.2.0",
"umd-tough-cookie": "2.4.3",
"cordova": "11.0.0",
"mocha": "9.2.2",
"umd-tough-cookie": "3.0.0",
"wd": "1.14.0",
"xml2js": "0.4.23"
}

View File

@ -3,7 +3,6 @@
"displayName": "HttpDemo",
"version": "1.0.0",
"description": "A sample Apache Cordova application that demonstrates advanced HTTP plugin.",
"main": "index.js",
"scripts": {
"build": "scripts/build.sh",
"test": "npm run build && scripts/test.sh"
@ -11,12 +10,11 @@
"author": "Sefa Ilkimen",
"license": "Apache-2.0",
"dependencies": {
"cordova": "10.0.0",
"cordova": "11.0.0",
"cordova-android": "10.1.1",
"cordova-browser": "6.0.0",
"cordova-ios": "6.2.0",
"cordova-plugin-device": "2.0.3",
"cordova-plugin-wkwebview-file-xhr": "3.0.0"
"cordova-plugin-device": "2.0.3"
},
"cordova": {
"platforms": [
@ -25,11 +23,7 @@
"browser"
],
"plugins": {
"cordova-plugin-device": {},
"cordova-plugin-wkwebview-file-xhr": {}
"cordova-plugin-device": {}
}
},
"devDependencies": {
"cordova-plugin-device": "2.0.3"
}
}

View File

@ -9,9 +9,7 @@ const hooks = {
}
helpers.setDefaultServerTrustMode(function () {
// @TODO: not ready yet
// helpers.setNoneClientAuthMode(resolve, reject);
resolve();
helpers.setNoneClientAuthMode(resolve, reject);
}, reject);
});
}
@ -23,12 +21,16 @@ const helpers = {
setPinnedServerTrustMode: function (resolve, reject) { cordova.plugin.http.setServerTrustMode('pinned', resolve, reject); },
setNoneClientAuthMode: function (resolve, reject) { cordova.plugin.http.setClientAuthMode('none', resolve, reject); },
setBufferClientAuthMode: function (resolve, reject) {
helpers.getWithXhr(function (pkcs) {
var path = cordova.file.applicationDirectory + 'www/certificates/badssl-client-cert.pkcs';
resolveLocalFileSystemURL(path, function(entry) {
helpers.readFileEntry(entry, 'buffer', function(pkcs) {
cordova.plugin.http.setClientAuthMode('buffer', {
rawPkcs: pkcs,
pkcsPassword: 'badssl.com'
}, resolve, reject);
}, './certificates/badssl-client-cert.pkcs', 'arraybuffer');
}, reject);
}, reject);
},
setJsonSerializer: function (resolve) { resolve(cordova.plugin.http.setDataSerializer('json')); },
setUtf8StringSerializer: function (resolve) { resolve(cordova.plugin.http.setDataSerializer('utf8')); },
@ -37,22 +39,7 @@ const helpers = {
setRawSerializer: function (resolve) { resolve(cordova.plugin.http.setDataSerializer('raw')); },
disableFollowingRedirect: function (resolve) { resolve(cordova.plugin.http.setFollowRedirect(false)); },
enableFollowingRedirect: function (resolve) { resolve(cordova.plugin.http.setFollowRedirect(true)); },
getWithXhr: function (done, url, type) {
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', function () {
if (!type || type === 'text') {
done(this.responseText);
} else {
done(this.response);
}
});
xhr.responseType = type;
xhr.open('GET', url);
xhr.send();
},
readFileEntryAsText: function(fileEntry, onSuccess, onFail) {
readFileEntry: function(fileEntry, contentType, onSuccess, onFail) {
var reader = new FileReader();
reader.onerror = onFail;
@ -62,7 +49,11 @@ const helpers = {
};
fileEntry.file(function(file) {
if (contentType === 'buffer') {
reader.readAsArrayBuffer(file);
} else {
reader.readAsText(file);
}
}, onFail);
},
writeToFile: function (done, fileName, content) {
@ -355,7 +346,7 @@ const tests = [
var targetPath = cordova.file.cacheDirectory + 'test.xml';
cordova.plugin.http.downloadFile(sourceUrl, {}, {}, targetPath, function (entry) {
helpers.readFileEntryAsText(entry, function(content) {
helpers.readFileEntry(entry, 'text', function (content) {
resolve({
sourceUrl: sourceUrl,
targetPath: targetPath,
@ -533,7 +524,7 @@ const tests = [
cordova.plugin.http.setCookie('http://httpbin.org/get', 'mySecondCookie=mySecondValue');
cordova.plugin.http.downloadFile(sourceUrl, {}, {}, targetPath, function (entry) {
helpers.readFileEntryAsText(entry, function (content) {
helpers.readFileEntry(entry, 'text', function (content) {
resolve({
sourceUrl: sourceUrl,
targetPath: targetPath,
@ -710,7 +701,7 @@ const tests = [
var targetPath = cordova.file.cacheDirectory + 'test.xml';
cordova.plugin.http.downloadFile(sourceUrl, {}, {}, targetPath, function (entry) {
helpers.readFileEntryAsText(entry, function (content) {
helpers.readFileEntry(entry, 'text', function (content) {
resolve({
sourceUrl: sourceUrl,
targetPath: targetPath,
@ -864,14 +855,18 @@ const tests = [
before: helpers.setMultipartSerializer,
func: function (resolve, reject) {
var ponyfills = cordova.plugin.http.ponyfills;
helpers.getWithXhr(function (blob) {
var path = cordova.file.applicationDirectory + 'www/res/cordova_logo.png';
resolveLocalFileSystemURL(path, function(entry) {
helpers.readFileEntry(entry, 'buffer', function(buffer) {
var formData = new ponyfills.FormData();
formData.append('CordovaLogo', blob);
formData.append('CordovaLogo', new Blob([buffer], { type: 'image/png' }));
var url = 'https://httpbin.org/anything';
var options = { method: 'post', data: formData };
cordova.plugin.http.sendRequest(url, options, resolve, reject);
}, './res/cordova_logo.png', 'blob');
}, reject);
}, reject);
},
validationFunc: function (driver, result) {
helpers.checkResult(result, 'resolved');
@ -890,9 +885,13 @@ const tests = [
expected: 'resolved: {"status":200,"data:application/octet-stream;base64,iVBORw0KGgoAAAANSUhEUg ...',
before: helpers.setRawSerializer,
func: function (resolve, reject) {
helpers.getWithXhr(function (buffer) {
var path = cordova.file.applicationDirectory + 'www/res/cordova_logo.png';
resolveLocalFileSystemURL(path, function(entry) {
helpers.readFileEntry(entry, 'buffer', function(buffer) {
cordova.plugin.http.post('http://httpbin.org/anything', buffer, {}, resolve, reject);
}, './res/cordova_logo.png', 'arraybuffer');
}, reject);
}, reject);
},
validationFunc: function (driver, result) {
helpers.checkResult(result, 'resolved');
@ -1088,7 +1087,7 @@ const tests = [
var targetPath = cordova.file.cacheDirectory + 'test.xml';
var reqId = cordova.plugin.http.downloadFile(sourceUrl, {}, {}, targetPath, function (entry) {
helpers.getWithXhr(function (content) {
helpers.readFileEntry(entry, 'text', function(content) {
resolve({
sourceUrl: sourceUrl,
targetPath: targetPath,
@ -1096,7 +1095,7 @@ const tests = [
name: entry.name,
content: content
});
}, targetPath);
}, reject);
}, reject);
setTimeout(function () {