sschueller sschueller - 1 year ago 264
reST (reStructuredText) Question

How can I get access to the Angular 2 http response body without converting it to string or json?

I would like to copy a REST response into a blob but I am unable to do some because

have not yet been implemented in the Response Object. The Response Body is a private variable.

return this.http.get(url, {params: params, headers: headers})
.map(res => {
// can't access _body because it is private
// no method appears to exist to get to the _body without modification
new Blob([res._body], {type: res.headers.get('Content-Type')});

Is there a solution I can use until these methods get implemented?

Answer Source

I can't see no other solutions before the following PR is merged:

Whereas you have a compilation error, the field can be used at runtime...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download