Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CapacitorHttp FormData Not Supported on Android Device but it working fine on ionic serve(browser) #29405

Closed
3 tasks done
mobiliseapplabllp opened this issue Apr 26, 2024 · 1 comment
Assignees
Labels

Comments

@mobiliseapplabllp
Copy link

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

when i hit api and using FormData, formData is empty on android device but it is working fine on browser

Expected Behavior

api should hit on both platform chrome and android and ios also when using FormData() and if i m using jsonObject then it is work fine

Steps to Reproduce

import { CapacitorHttp, HttpResponse } from '@capacitor/core';

// Post Function
async postTest() {
const formData = new FormData();
formData.append('username', 'superadmin');
formData.append('password', 'password');
formData.append('source', 'Mobile');
const doPost = async () => {
const options = {
url: environment.url1 + 'login',
headers: {
'Accept': 'application/json',
'Access-Control-Allow-Origin': '*'
},
data: formData,
};
const response: HttpResponse = await CapacitorHttp.post(options);
};
doPost();
}

Code Reproduction URL

NA

Ionic Info

// capacitor.config.ts
import type { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
appId: 'com.hseglobal.mbl',
appName: 'HSE Global',
webDir: 'www',
plugins: {
CapacitorHttp: {
enabled: true,
},
},
};

export default config;

//ionic and capacitor info
"@angular/animations": "^17.0.2",
"@angular/common": "^17.0.2",
"@angular/compiler": "^17.0.2",
"@angular/core": "^17.0.2",
"@angular/forms": "^17.0.2",
"@capacitor/android": "^6.0.0",
"@capacitor/app": "6.0.0",
"@capacitor/core": "6.0.0",
"@capacitor/haptics": "6.0.0",
"@capacitor/keyboard": "6.0.0",
"@capacitor/status-bar": "6.0.0",
"@ionic/angular": "^7.0.0",

Additional Information

No response

@sean-perkins
Copy link
Contributor

Hello @mobiliseapplabllp this repository is for the UI components (Ionic Framework), not Capacitor. You should open a ticket on the Capacitor repository.

I would recommend creating a minimal reproduction with that report, as with the current information the team will likely not be able to root cause.

@sean-perkins sean-perkins closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants