HTTP
Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and Android.
Advantages over Javascript requests:
- SSL / TLS Pinning
- CORS restrictions do not apply
- Handling of HTTP code 401 - read more at Issue CB-2415
https://github.com/silkimen/cordova-plugin-advanced-http
Stuck on a Cordova issue?
If you're building a serious project, you can't afford to spend hours troubleshooting. Ionicβs experts offer premium advisory services for both community plugins and premier plugins.
Installation
- Capacitor
- Cordova
- Enterprise
$ npm install cordova-plugin-advanced-http
$ npm install @awesome-cordova-plugins/http
$ ionic cap sync
$ ionic cordova plugin add cordova-plugin-advanced-http
$ npm install @awesome-cordova-plugins/http
Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Β Learn More or if you're interested in an enterprise version of this plugin Contact Us
Supported Platforms
- Android
- iOS
Usage
React
Learn more about using Ionic Native components in React
Angular
import { HTTP } from '@awesome-cordova-plugins/http/ngx';
constructor(private http: HTTP) {}
...
this.http.get('http://ionic.io', {}, {})
.then(data => {
console.log(data.status);
console.log(data.data); // data received by server
console.log(data.headers);
})
.catch(error => {
console.log(error.status);
console.log(error.error); // error message as string
console.log(error.headers);
});