Is there a way to make a non-JSON request to the server using Angular 6 HttpClient (@angular/common/http) in order to receive an Octet-stream? Below is the code I have tried:
getFile(file: any) {
let headers = new HttpHeaders({
'Content-Type': 'application/octet-stream',
'Accept':'application/octet-stream',
'Authorization': 'Bearer ' + data.token
})
return this.http.get<any>(this.baseUrl + '/getfile/'+file, { headers });
}
However, this code results in a JSON parse error.
"HttpErrorResponse", message: "Http failure during parsing for..... ERROR {…} error: {…} error: SyntaxError: "JSON.parse: unexpected character at line 1 column 1 of the JSON data"
Can anyone suggest how to retrieve this data as non-JSON?