Angular download file download.json - sorry
Download file from http post request - Angular 6
UPDATED with res.send(data) instead of res.json(data)
Using Angular 6 and NodeJS I am doing a web application. I am trying to download a file from a http post request.
I send a request to the server like this. From my component I call a function in a service. In the component, I susbscribe to have the answer of the server and when I have it I create a new Blob with the response and I Use FileSaver to download the pdf.
Now, when I received the answer from the server, the client sees it like an error whereas the status is 200. The error message is: "Http failure during parsing for http://localhost:3000/api/experiment/regression" See the screenshot below.
Component.ts
API.Service.ts
Then from the server, it executes some code with the data sent and generates a PDF file. Then, I would like to send the pdf as a response to the client. I tried like this:
In the client, I have the answer. The console log is:
-