Just a few minutes back, I set up a new project in the latest version of Ionic. I included
import { HTTP } from '@ionic-native/http'
and then proceeded to send a GET request to my backend application.
meetingsUrl: 'http://localhost:8080/test/all';
this.http.useBasicAuth('login','password');
this.http.get(this.meetingsUrl,{}, {'Content-Type':'application/json'})
.then(data => {
console.log(data);
})
.catch(error => {
console.log(error);
});
I'm using the 'ionic cordova run browser' command. I also attempted to run it on an android device, but encountered the same issue.
Unfortunately, in both scenarios, I encountered the following error:
TypeError: Cannot read property 'match' of undefined
at getMatchingHostHeaders (advanced-http.js:118)
at getMergedHeaders (advanced-http.js:126)
at Object.get (advanced-http.js:210)
at callCordovaPlugin (plugin.js:110)
at plugin.js:136
at util.js:22
at new t (polyfills.js:3)
at tryNativePromise (util.js:21)
at getPromise (util.js:29)
at wrapPromise (plugin.js:119)