Socket
Socket
Sign inDemoInstall

@capacitor/ios

Package Overview
Dependencies
Maintainers
7
Versions
756
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor/ios - npm Package Compare versions

Comparing version 5.5.1-nightly-20231025T150424.0 to 5.5.1

Capacitor/Capacitor/CAPWebView.swift

78

Capacitor/Capacitor/assets/native-bridge.js

@@ -67,4 +67,48 @@

};
const convertBody = async (body) => {
if (body instanceof FormData) {
const convertBody = async (body, contentType) => {
if (body instanceof ReadableStream) {
const reader = body.getReader();
const chunks = [];
while (true) {
const { done, value } = await reader.read();
if (done)
break;
chunks.push(value);
}
const concatenated = new Uint8Array(chunks.reduce((acc, chunk) => acc + chunk.length, 0));
let position = 0;
for (const chunk of chunks) {
concatenated.set(chunk, position);
position += chunk.length;
}
let data = new TextDecoder().decode(concatenated);
let type;
if (contentType === 'application/json') {
try {
data = JSON.parse(data);
}
catch (ignored) {
// ignore
}
type = 'json';
}
else if (contentType === 'multipart/form-data') {
type = 'formData';
}
else if (contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('image')) {
type = 'image';
}
else if (contentType === 'application/octet-stream') {
type = 'binary';
}
else {
type = 'text';
}
return {
data,
type,
headers: { 'Content-Type': contentType || 'application/octet-stream' },
};
}
else if (body instanceof FormData) {
const formData = await convertFormData(body);

@@ -435,5 +479,6 @@ const boundary = `${Date.now()}`;

try {
// intercept request & pass to the bridge
const { body, method } = request;
const { data: requestData, type, headers, } = await convertBody(body || undefined);
const optionHeaders = Object.fromEntries(request.headers.entries());
const { data: requestData, type, headers, } = await convertBody((options === null || options === void 0 ? void 0 : options.body) || body || undefined, optionHeaders['Content-Type'] || optionHeaders['content-type']);
const nativeResponse = await cap.nativePromise('CapacitorHttp', 'request', {

@@ -589,9 +634,19 @@ url: request.url,

this.status = nativeResponse.status;
const responseString = typeof nativeResponse.data !== 'string'
? JSON.stringify(nativeResponse.data)
: nativeResponse.data;
if (this.responseType === '' ||
this.responseType === 'text') {
this.response =
typeof nativeResponse.data !== 'string'
? JSON.stringify(nativeResponse.data)
: nativeResponse.data;
this.response = responseString;
}
else if (this.responseType === 'blob') {
this.response = new Blob([responseString], {
type: 'application/json',
});
}
else if (this.responseType === 'arraybuffer') {
const encoder = new TextEncoder();
const uint8Array = encoder.encode(responseString);
this.response = uint8Array.buffer;
}
else {

@@ -662,3 +717,3 @@ this.response = nativeResponse.data;

for (const key in this._headers) {
if (key != 'Set-Cookie') {
if (key.toLowerCase() !== 'set-cookie') {
returnString += key + ': ' + this._headers[key] + '\r\n';

@@ -674,3 +729,8 @@ }

}
return this._headers[name];
for (const key in this._headers) {
if (key.toLowerCase() === name.toLowerCase()) {
return this._headers[key];
}
}
return null;
};

@@ -677,0 +737,0 @@ Object.setPrototypeOf(xhr, prototype);

4

package.json
{
"name": "@capacitor/ios",
"version": "5.5.1-nightly-20231025T150424.0",
"version": "5.5.1",
"description": "Capacitor: Cross-platform apps with JavaScript and the web",

@@ -28,3 +28,3 @@ "homepage": "https://capacitorjs.com",

"peerDependencies": {
"@capacitor/core": "^5.5.0-nightly-20231025T150424.0"
"@capacitor/core": "^5.5.0"
},

@@ -31,0 +31,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc