Skip to content

Commit

Permalink
fix(ios): crash when http headers contain numbers (#6251)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Jan 26, 2023
1 parent 6c2726d commit 028c556
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
8 changes: 5 additions & 3 deletions android/capacitor/src/main/assets/native-bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*! Capacitor: https://capacitorjs.com/ - MIT License */
/* Generated File. Do not edit. */

const nativeBridge = (function (exports) {
var nativeBridge = (function (exports) {
'use strict';

var ExceptionCode;
Expand Down Expand Up @@ -376,7 +376,9 @@ const nativeBridge = (function (exports) {
url: resource,
method: (options === null || options === void 0 ? void 0 : options.method) ? options.method : undefined,
data: (options === null || options === void 0 ? void 0 : options.body) ? options.body : undefined,
headers: (options === null || options === void 0 ? void 0 : options.headers) ? options.headers : undefined,
headers: (options === null || options === void 0 ? void 0 : options.headers)
? JSON.stringify(options.headers)
: undefined,
});
const data = typeof nativeResponse.data === 'string'
? nativeResponse.data
Expand Down Expand Up @@ -500,7 +502,7 @@ const nativeBridge = (function (exports) {
url: this._url,
method: this._method,
data: body !== null ? body : undefined,
headers: this._headers,
headers: JSON.stringify(this._headers),
})
.then((nativeResponse) => {
// intercept & parse response before returning
Expand Down
6 changes: 4 additions & 2 deletions core/native-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,9 @@ const initBridge = (w: any): void => {
url: resource,
method: options?.method ? options.method : undefined,
data: options?.body ? options.body : undefined,
headers: options?.headers ? options.headers : undefined,
headers: options?.headers
? JSON.stringify(options.headers)
: undefined,
},
);

Expand Down Expand Up @@ -583,7 +585,7 @@ const initBridge = (w: any): void => {
url: this._url,
method: this._method,
data: body !== null ? body : undefined,
headers: this._headers,
headers: JSON.stringify(this._headers),
})
.then((nativeResponse: any) => {
// intercept & parse response before returning
Expand Down
8 changes: 5 additions & 3 deletions ios/Capacitor/Capacitor/assets/native-bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*! Capacitor: https://capacitorjs.com/ - MIT License */
/* Generated File. Do not edit. */

const nativeBridge = (function (exports) {
var nativeBridge = (function (exports) {
'use strict';

var ExceptionCode;
Expand Down Expand Up @@ -376,7 +376,9 @@ const nativeBridge = (function (exports) {
url: resource,
method: (options === null || options === void 0 ? void 0 : options.method) ? options.method : undefined,
data: (options === null || options === void 0 ? void 0 : options.body) ? options.body : undefined,
headers: (options === null || options === void 0 ? void 0 : options.headers) ? options.headers : undefined,
headers: (options === null || options === void 0 ? void 0 : options.headers)
? JSON.stringify(options.headers)
: undefined,
});
const data = typeof nativeResponse.data === 'string'
? nativeResponse.data
Expand Down Expand Up @@ -500,7 +502,7 @@ const nativeBridge = (function (exports) {
url: this._url,
method: this._method,
data: body !== null ? body : undefined,
headers: this._headers,
headers: JSON.stringify(this._headers),
})
.then((nativeResponse) => {
// intercept & parse response before returning
Expand Down

0 comments on commit 028c556

Please sign in to comment.