Answer the question
In order to leave comments, you need to log in
How to download bpmn file?
I get a bpmn file via http. Through the network tab, I see that this file is coming to the browser. It's in XML format. The problem is that when trying to display the contents of the response via console.log()
this.service.getBpnm(123).subscribe(bpnm => {
debugger
console.log(bpnm);
});
error:
error: SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse ...
headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ}
message: "Http failure during parsing for http://localhost:4200/..."
name: "HttpErrorResponse"
ok: false
status: 200
statusText: "OK"
url: "http://localhost:4200/...
return this.http.get('qwerty', { headers: new HttpHeaders().set('Content-Type', 'application/octet-stream') });
Answer the question
In order to leave comments, you need to log in
In addition to headers, specify a responseType other than json.
options: {
headers?: HttpHeaders | {[header: string]: string | string[]},
observe?: 'body' | 'events' | 'response',
params?: HttpParams|{[param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>},
reportProgress?: boolean,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
withCredentials?: boolean,
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question