从API接收“应用程序/八位字节流”时,JSON中出现意外令牌

时间:2018-06-26 17:28:38

标签: angular

我的Web API返回的流为“ application / octet-stream”。我可以在响应中看到内容,它不是json。

在我的角度代码中,我有

   const headers = new HttpHeaders({ responseType: 'blob', 'Authorization': 'Bearer ' + r.access_token });

        return this.http.get<Blob>(this.getFullUrl(actionUrl), { headers: headers}).pipe(
            catchError(this.onCatch));

它仍然抛出错误提示

  

“ JSON中的意外令牌”不知道如何告诉它不要   需要JSON。我尝试设置“内容类型”:   “应用程序/八位字节流”

在http中也是如此。

0 个答案:

没有答案