我想將一個REST響應複製到一個blob中,但我無法做一些,因爲blob()
和arrayBuffer()
尚未在響應對象中實現。 Response Body是一個私有變量。如何在不將其轉換爲字符串或json的情況下訪問Angular 2 http響應主體?
...
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')});
})
.catch(this.log);
...
是否有解決方案,我可以使用,直到這些方法得到實施?
哇!這個解決方案實際上允許npm編譯我的TS!你甚至在哪裏找到這個? –
有很多涉及試驗和錯誤,所以我不能真正記得我害怕。 – StudioLE