Why do you need this plugin?
We need this plugin to make the HTTP calls, from the cell phone application. When you do not have the CORS enabled in your backend services. Your API does not send “Access-Control-Allow-Origin: ‘*’”.
What if I do not use this plugin?
You get a CORS error in your application. You need to use this to make the API calls.
How do we use “cordova-plugin-advanced-http” plugin in ionic-react app?
Here are the steps to use this plugin,
Step 1: Ionic cordova plugin add cordova-plugin-advanced-http
Step 2: npm i @ionic-native/http
Step 3: Now time for the code in your .ts file
import {HTTP} from '@ionic-native/http';
/* You other code*/
/* You other function/class*/
HTTP.setServerTrustMode('default'); // It could either be default, pinned, nocheck, legacy
HTTP.setDataSerializer('json');
HTTP.post('<api-url>', {data:'yourdata'}, {headers});