Ionic Native HTTP instead of angulars http

try this.http.http.get(). The first http is of the component, the second http is of the http wrapper (native or angular), then the method.

Hi,

I tried that and it didn’t work. What did work was adding the get() function to the http.ts class.

get(url, params, options) {
  return this.http.get(url, params, options);
}

Thanks for the code.

Regards.
JJ

Hi @virtualbankingapp,

we haven’t implemented the certificate pinning, yet. This feature was postponed for a future time.
I’ll post my experiences, as soon as I get into this again.

Sorry that I couldn’t help at this one.

Sorry, you are right. I have forgotten to add get() and post() wrappers. The whole HttpProvider class should be as follows:

providers/http/http.ts

import {Injectable} from '@angular/core';
import {Platform} from 'ionic-angular';

import {HttpAngularProvider} from '../http-angular/http-angular';
import {HttpNativeProvider} from '../http-native/http-native';

@Injectable()
export class HttpProvider {
    private http: HttpNativeProvider | HttpAngularProvider;

    constructor(private platform: Platform, private angularHttp: HttpAngularProvider, private nativeHttp: HttpNativeProvider) {
        this.http = this.platform.is('ios') || this.platform.is('android') ? this.nativeHttp : this.angularHttp;
    }

    public get(url: string, params?: any, options?: any) {
        return this.http.get(url, params, options);
    }

    public post(url: string, params?: any, options?: any) {
        return this.http.post(url, params, options);
    }
}
1 Like

Hi @mburger81,

have tried to implement this Network Security Configuration thing?
How can we attach this xml into Ionic/Cordova based apps?

Thanks. All good. Didn’t take too long to figure that out :slight_smile:

1 Like

Hello deggial,

how do you set the withCredentialsFlag for the HttpNativeProvider?

is we need to create provider before make a http native request?