@capacitor/ios 5.7.3 → 5.7.5

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
  const boundary = `${Date.now()}`;
@@ -145,13 +151,10 @@ var nativeBridge = (function (exports) {
145
151
  const proxyUrl = new URL(url);
146
152
  const bridgeUrl = new URL((_b = (_a = win.Capacitor) === null || _a === void 0 ? void 0 : _a.getServerUrl()) !== null && _b !== void 0 ? _b : '');
147
153
  const isHttps = proxyUrl.protocol === 'https:';
148
- const originalHost = encodeURIComponent(proxyUrl.host);
149
- const originalPathname = proxyUrl.pathname;
150
- proxyUrl.protocol = bridgeUrl.protocol;
151
- proxyUrl.hostname = bridgeUrl.hostname;
152
- proxyUrl.port = bridgeUrl.port;
153
- proxyUrl.pathname = `${isHttps ? CAPACITOR_HTTPS_INTERCEPTOR : CAPACITOR_HTTP_INTERCEPTOR}/${originalHost}${originalPathname}`;
154
- return proxyUrl.toString();
154
+ bridgeUrl.search = proxyUrl.search;
155
+ bridgeUrl.hash = proxyUrl.hash;
156
+ bridgeUrl.pathname = `${isHttps ? CAPACITOR_HTTPS_INTERCEPTOR : CAPACITOR_HTTP_INTERCEPTOR}/${encodeURIComponent(proxyUrl.host)}${proxyUrl.pathname}`;
157
+ return bridgeUrl.toString();
155
158
  };
156
159
  const initBridge = (w) => {
157
160
  const getPlatformId = (win) => {
@@ -382,15 +385,15 @@ var nativeBridge = (function (exports) {
382
385
  typeof c.dir === 'function');
383
386
  };
384
387
  const serializeConsoleMessage = (msg) => {
385
- if (typeof msg === 'object') {
386
- try {
388
+ try {
389
+ if (typeof msg === 'object') {
387
390
  msg = JSON.stringify(msg);
388
391
  }
389
- catch (e) {
390
- // ignore
391
- }
392
+ return String(msg);
393
+ }
394
+ catch (e) {
395
+ return '';
392
396
  }
393
- return String(msg);
394
397
  };
395
398
  const platform = getPlatformId(win);
396
399
  if (platform == 'android' || platform == 'ios') {
@@ -499,11 +502,11 @@ var nativeBridge = (function (exports) {
499
502
  if (request.url.startsWith(`${cap.getServerUrl()}/`)) {
500
503
  return win.CapacitorWebFetch(resource, options);
501
504
  }
502
- if (!(options === null || options === void 0 ? void 0 : options.method) ||
503
- options.method.toLocaleUpperCase() === 'GET' ||
504
- options.method.toLocaleUpperCase() === 'HEAD' ||
505
- options.method.toLocaleUpperCase() === 'OPTIONS' ||
506
- options.method.toLocaleUpperCase() === 'TRACE') {
505
+ const { method } = request;
506
+ if (method.toLocaleUpperCase() === 'GET' ||
507
+ method.toLocaleUpperCase() === 'HEAD' ||
508
+ method.toLocaleUpperCase() === 'OPTIONS' ||
509
+ method.toLocaleUpperCase() === 'TRACE') {
507
510
  if (typeof resource === 'string') {
508
511
  return await win.CapacitorWebFetch(createProxyUrl(resource, win), options);
509
512
  }
@@ -515,8 +518,7 @@ var nativeBridge = (function (exports) {
515
518
  const tag = `CapacitorHttp fetch ${Date.now()} ${resource}`;
516
519
  console.time(tag);
517
520
  try {
518
- // intercept request & pass to the bridge
519
- const { body, method } = request;
521
+ const { body } = request;
520
522
  const optionHeaders = Object.fromEntries(request.headers.entries());
521
523
  const { data: requestData, type, headers, } = await convertBody((options === null || options === void 0 ? void 0 : options.body) || body || undefined, optionHeaders['Content-Type'] || optionHeaders['content-type']);
522
524
  const nativeResponse = await cap.nativePromise('CapacitorHttp', 'request', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/ios",
3
- "version": "5.7.3",
3
+ "version": "5.7.5",
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)",