I have a problem in Android with CapacitorHttp and with Http from ‘@capacitor-community/http’ .
The data sent to the server is empty, in the console log I can see the data, but the server don’t receive any data. With other platforms (browser and ios) it works fine, but not in Android (emulator and device).
Please, any suggestions? This is my ionic info:
Ionic:
Ionic CLI : 7.1.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 7.4.1
@angular-devkit/build-angular : 16.2.3
@angular-devkit/schematics : 16.2.3
@angular/cli : 16.2.3
@ionic/angular-toolkit : 10.0.0
Capacitor:
Capacitor CLI : 5.4.1
@capacitor/android : 5.4.1
@capacitor/core : 5.4.1
@capacitor/ios : 5.4.1
Utility:
cordova-res : not installed globally
native-run : 1.7.3
System:
NodeJS : v18.17.1 (/usr/local/bin/node)
npm : 9.6.7
OS : macOS Unknown
Thanks for your help.
Ionic api calls.
const options : HttpOptions= {
url: "https://fakeapi.com/url",
headers: {'Content-Type': 'multipart/form-data'},
data: {nickname:"fakenickname",password:"fakepassword"}
};
const response: HttpResponse = await CapacitorHttp.post(options);
server calls log with iOs and browser (correct):
{"post":{"nickname":"fakenickname","password":"fakepassword"},"get":{"_":"2023-09-22T09:20:25.556Z"},"req":{"\/url":"","nickname":"fakenickname","password":"fakepassword"}}
server calls log with Android (NOT correct):
{"post":[],"get":{"_":"2023-09-21T17:53:24.196Z"},"req":{"\/url":""}}