I’m making a HTTP Get call to my API. My POST works fine and returns the correct response body.
When I run as Ionic Serve, my GET also returns the correct body with the object, but when I run the app as Ionic Cordova Run Android my GET resturns me my index.html as a response body.
I can’t make it work, can anybody help me, please?
This is my GET
import { Http, RequestOptions, Headers } from '@angular/http';
async getPersonByFilter(filter) {
return new Promise((resolve, reject) => {
let headers = new Headers();
headers.append('Authorization', ' Bearer ' + this.userToken.access_token);
let options = new RequestOptions({ headers: headers });
let baseURL = "/api";
this.http.get(baseURL + '/Person?Filter=' + filter, options)
.subscribe(res => {
console.info("res: " + res)
resolve(res);
}, (err) => {
console.log("Not working: " + err)
reject(err);
});
});
This is the response when I run on Android