chore: update all dependencies

This commit is contained in:
Sefa Ilkimen
2022-03-30 23:14:37 +02:00
parent 9870dde50a
commit c92f07775b
4 changed files with 3419 additions and 3967 deletions

7285
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", "homepage": "https://github.com/silkimen/cordova-plugin-advanced-http#readme",
"devDependencies": { "devDependencies": {
"chai": "4.2.0", "chai": "4.3.6",
"colors": "1.4.0", "colors": "1.4.0",
"cordova": "10.0.0", "cordova": "11.0.0",
"mocha": "8.2.0", "mocha": "9.2.2",
"umd-tough-cookie": "2.4.3", "umd-tough-cookie": "3.0.0",
"wd": "1.14.0", "wd": "1.14.0",
"xml2js": "0.4.23" "xml2js": "0.4.23"
} }

View File

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

View File

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