I am making an http post request from my iOS app built with Ionic. I can view the data on the server, so I know its working, but the console prints ‘Upload failed!’ and the following error:
{"_body":{“isTrusted”:true},“status”:0,“ok”:false,“statusText”:"",“headers”:{},“type”:3,“url”:n
ull}
Here is my code:
this.http.post(url, postParams, options)
.subscribe(data => {
console.log('Upload succeeded!');
console.log(JSON.stringify(data['_body']));
resolve(data['_body']);
}, error => {
console.log('Upload failed!');
console.log(JSON.stringify(error)); // Error getting the data
resolve(error);
});
Why would it work, but go to the error branch of the observable (subscribe)?