If I change this here to the TXT endpoint and then click the fetch people button, nothing happens. Otherwise, Angular will try to parse the plaintext response, even if the response MIME type is set to text/plain. What happens for instance if we have another endpoint, let's say people TXT which returns the data as the text format which is not JSON obviously? Let's give it a try. In order for Angular’s HttpClient to process plaintext responses and not result in an error, you need to set responseType: 'text' in the options (which is the second parameter to. Now, with new HTTP client which we are using here which has been introduced in Angular version 4.3.1, by default the response sent from the server gets interpreted as JSON format, so there's no more need as was the case before to basically parse this response and map it JSON, which is a nice addition of this new HTTP client. I'm serving this project with Angular CLI so therefore here I have an asset, an asset folder, a people JSON file which gets here rendered and served by the integrated Web server. In this people service that gets used by the app component to fetch the data, we issue an HTTP call to this endpoint here. There are two key differences: Blob.text () returns a promise, whereas FileReader.readAsText () is an event based API.
![Angular http get plain text](https://loka.nahovitsyn.com/140.jpg)