I have a service that makes an http call to my backend:
exportSubs(param: Param): Observable<Sub[]> {
return this.http.get<Sub[]>(
`${environment.apiBaseUrl}/blah`,
{headers: this.httpUtil.getReqHeaders})
.catch(error => this.httpUtil.handleError(error));
}
where do I set responseType?
You can specify that the data to be returned is not a JSON using the responseType
. See the Requesting non JSON data
In your example, you should be able to use:
return this.http.get(
`${environment.apiBaseUrl}/blah`, { responseType: 'text' })
EDIT
You can set the responseType as blob,
return this.http.get(`${environment.apiBaseUrl}/blah`, { responseType: 'blob' });