I have an ionic app through which i'm calling a rest service with a POST method. I am sending a large string of base64 data to the server. Everything works fine if i send the request through Postman. But, when i send it through the App, it gives me a 400 Bad Request error. This is my angular provider code :-
uploadPic(bugImage : any){
const headers1 = new HttpHeaders();
headers1.append('Content-Type', 'application/json');
return this.http.post(this._global.LocalserviceURL + 'ReportaBug', JSON.stringify(bugImage),{headers : headers1}).map(result => result).catch(this.errorHandler);
}
errorHandler(error: HttpErrorResponse) {
return Observable.throw(error.message || "Sever Error");
}
and this is how i am using the provider method :-
onBasicUpload(e: any) {
this.imgpov.uploadPic(this.test).subscribe(res => {
console.log(res);
})
I've looked online and it says to send headers too. I guess i'm sending appropriate headers. How do i get this working?