HTTP

Contents

Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and Android.

Advantages over Javascript requests:

  • Background threading - all requests are done in a background thread
  • SSL Pinning

Installation

ionic cordova plugin add cordova-plugin-advanced-httpnpm install @ionic-native/http
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEYnpm install @ionic-enterprise/http

Supported Platforms

  • Android
  • iOS

Usage

import { HTTP } from '@ionic-native/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);

  });