Angular7: unable to set {responseType: 'text'}

You can't use return generic type. In documentation generic type is only for 'json'. This mean you need use get like this:

return this.http.get(this.streamURL, { responseType: "text"});

See in documentation https://angular.io/api/common/http/HttpClient#get You are interest Overload #11 and now you are using Overload #13

Finally this is link for your code with update: https://stackblitz.com/edit/angular-gv1tkl?file=src/app/myS.service.ts

EDIT 1

I pasted wrong link to stackblitz. Correct above.


I always use the following patterns in this case:

returnObservable(): Observable<any> {
  const requestOptions: Object = {
    /* other options here */
    responseType: 'text'
  }
  return this.http.get<any>(this.streamURL , requestOptions);
}

Hope it answers your question!