After trying many things read here, i still couldn't find a solution to this particular problem: I make a request from angular (localhost:4200) to an API on spring (localhost:8080), I have an HttpService that handles request just fine, until I have to make a request which response is not a JSON, but an image/png:
private httpOptions = {
headers: new HttpHeaders({
'Accept': 'image/png',
'Content-Type': 'image/png'
})
};
constructor(private http: HttpService) { }
getVehicleQr(vehicleId: string): Observable<any> {
return this.http.get('/vehicle/qr/' + vehicleId, this.httpOptions);
}
I've set the Accept and Content-Type headers in the httpOptions, yet when I execute the getVehicleQr() method, I get this error:
this suggest that Angular is still trying to parse a JSON where i set it not to. Any suggestions? full code can be found here.
I've also seen this post.