I want to get image from Express server with Angular using its filename:
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:
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 applies the 'json()' method to the response, so if your response is non-JSON data, you'll get this type of error.
Although it is the most common, you will sometimes deal with different types of data. This is supported through the responseType property.
this.http.get('...', { responseType: 'text' }); //response type?: 'arraybuffer' | 'stain' | 'json' | 'text'