Skip to content

Commit

Permalink
fix(http): Add URLSearchParams support (#7374)
Browse files Browse the repository at this point in the history
Co-authored-by: Phil Jones <pjones@vqcomms.com>
  • Loading branch information
jcesarmobile and philjones88 committed Apr 2, 2024
1 parent 7963594 commit 9367ecc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions android/capacitor/src/main/assets/native-bridge.js
Expand Up @@ -109,6 +109,12 @@ var nativeBridge = (function (exports) {
headers: { 'Content-Type': contentType || 'application/octet-stream' },
};
}
else if (body instanceof URLSearchParams) {
return {
data: body.toString(),
type: 'text',
};
}
else if (body instanceof FormData) {
const formData = await convertFormData(body);
return {
Expand Down
5 changes: 5 additions & 0 deletions core/native-bridge.ts
Expand Up @@ -96,6 +96,11 @@ const convertBody = async (
type,
headers: { 'Content-Type': contentType || 'application/octet-stream' },
};
} else if (body instanceof URLSearchParams) {
return {
data: body.toString(),
type: 'text',
};
} else if (body instanceof FormData) {
const formData = await convertFormData(body);
return {
Expand Down
6 changes: 6 additions & 0 deletions ios/Capacitor/Capacitor/assets/native-bridge.js
Expand Up @@ -109,6 +109,12 @@ var nativeBridge = (function (exports) {
headers: { 'Content-Type': contentType || 'application/octet-stream' },
};
}
else if (body instanceof URLSearchParams) {
return {
data: body.toString(),
type: 'text',
};
}
else if (body instanceof FormData) {
const formData = await convertFormData(body);
return {
Expand Down

0 comments on commit 9367ecc

Please sign in to comment.