I want to get image from Express server with Angular using its filename:
Request from Angular service
And I want to send the file back to the client:
Sending file from Express server
When I log the response from the server I get the following error:
Error message from response
I am nearly sure that I am missing any options either in my request or in my response, but I am not sure what.
Any help would be highly appreciated.
HttpClient applay 'json()' method to the respond so if your respond is non-JSON data you will get this kind of error.
Although it’s the most common, sometimes you’ll deal with different sorts of data. This is supported via the responseType property.
this.http.get('...', { responseType: 'text' }); //
responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With