@capacitor/android 6.0.0-rc.2 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -109,6 +109,12 @@ var nativeBridge = (function (exports) {
|
|
|
109
109
|
headers: { 'Content-Type': contentType || 'application/octet-stream' },
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
+
else if (body instanceof URLSearchParams) {
|
|
113
|
+
return {
|
|
114
|
+
data: body.toString(),
|
|
115
|
+
type: 'text',
|
|
116
|
+
};
|
|
117
|
+
}
|
|
112
118
|
else if (body instanceof FormData) {
|
|
113
119
|
const formData = await convertFormData(body);
|
|
114
120
|
return {
|
|
@@ -492,11 +498,11 @@ var nativeBridge = (function (exports) {
|
|
|
492
498
|
if (request.url.startsWith(`${cap.getServerUrl()}/`)) {
|
|
493
499
|
return win.CapacitorWebFetch(resource, options);
|
|
494
500
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
501
|
+
const { method } = request;
|
|
502
|
+
if (method.toLocaleUpperCase() === 'GET' ||
|
|
503
|
+
method.toLocaleUpperCase() === 'HEAD' ||
|
|
504
|
+
method.toLocaleUpperCase() === 'OPTIONS' ||
|
|
505
|
+
method.toLocaleUpperCase() === 'TRACE') {
|
|
500
506
|
if (typeof resource === 'string') {
|
|
501
507
|
return await win.CapacitorWebFetch(createProxyUrl(resource, win), options);
|
|
502
508
|
}
|
|
@@ -508,7 +514,7 @@ var nativeBridge = (function (exports) {
|
|
|
508
514
|
const tag = `CapacitorHttp fetch ${Date.now()} ${resource}`;
|
|
509
515
|
console.time(tag);
|
|
510
516
|
try {
|
|
511
|
-
const { body
|
|
517
|
+
const { body } = request;
|
|
512
518
|
const optionHeaders = Object.fromEntries(request.headers.entries());
|
|
513
519
|
const { data: requestData, type, headers, } = await convertBody((options === null || options === void 0 ? void 0 : options.body) || body || undefined, optionHeaders['Content-Type'] || optionHeaders['content-type']);
|
|
514
520
|
const nativeResponse = await cap.nativePromise('CapacitorHttp', 'request', {
|
|
@@ -52,23 +52,26 @@ public class CapacitorCookieManager extends CookieManager {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
public String getSanitizedDomain(String url) throws URISyntaxException {
|
|
55
|
-
if (url == null || url.isEmpty()) {
|
|
55
|
+
if (this.serverUrl != null && !this.serverUrl.isEmpty() && (url == null || url.isEmpty() || this.serverUrl.contains(url))) {
|
|
56
56
|
url = this.serverUrl;
|
|
57
|
+
} else if (this.localUrl != null && !this.localUrl.isEmpty() && (url == null || url.isEmpty() || this.localUrl.contains(url))) {
|
|
58
|
+
url = this.localUrl;
|
|
59
|
+
} else try {
|
|
60
|
+
URI uri = new URI(url);
|
|
61
|
+
String scheme = uri.getScheme();
|
|
62
|
+
if (scheme == null || scheme.isEmpty()) {
|
|
63
|
+
url = "https://" + url;
|
|
64
|
+
}
|
|
65
|
+
} catch (URISyntaxException e) {
|
|
66
|
+
Logger.error(TAG, "Failed to get scheme from URL.", e);
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
try {
|
|
60
70
|
new URI(url);
|
|
61
|
-
} catch (Exception
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
new URI(url);
|
|
66
|
-
} catch (Exception error) {
|
|
67
|
-
Logger.error(TAG, "Failed to get sanitized URL.", error);
|
|
68
|
-
throw error;
|
|
69
|
-
}
|
|
71
|
+
} catch (Exception error) {
|
|
72
|
+
Logger.error(TAG, "Failed to get sanitized URL.", error);
|
|
73
|
+
throw error;
|
|
70
74
|
}
|
|
71
|
-
|
|
72
75
|
return url;
|
|
73
76
|
}
|
|
74
77
|
|
|
@@ -11,8 +11,8 @@ import com.getcapacitor.annotation.CapacitorPlugin;
|
|
|
11
11
|
import com.getcapacitor.annotation.Permission;
|
|
12
12
|
import com.getcapacitor.plugin.util.CapacitorHttpUrlConnection;
|
|
13
13
|
import com.getcapacitor.plugin.util.HttpRequestHandler;
|
|
14
|
-
import java.util.HashMap;
|
|
15
14
|
import java.util.Map;
|
|
15
|
+
import java.util.concurrent.ConcurrentHashMap;
|
|
16
16
|
import java.util.concurrent.ExecutorService;
|
|
17
17
|
import java.util.concurrent.Executors;
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@ import java.util.concurrent.Executors;
|
|
|
24
24
|
)
|
|
25
25
|
public class CapacitorHttp extends Plugin {
|
|
26
26
|
|
|
27
|
-
private final Map<Runnable, PluginCall> activeRequests = new
|
|
27
|
+
private final Map<Runnable, PluginCall> activeRequests = new ConcurrentHashMap<>();
|
|
28
28
|
private final ExecutorService executor = Executors.newCachedThreadPool();
|
|
29
29
|
|
|
30
30
|
@Override
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/android",
|
|
3
|
-
"version": "6.0.0
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
|
5
5
|
"homepage": "https://capacitorjs.com",
|
|
6
6
|
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"verify": "./gradlew clean lint build test -b capacitor/build.gradle"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@capacitor/core": "^6.0.0
|
|
26
|
+
"@capacitor/core": "^6.0.0"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|