JSON在位置0处出现意外令牌%:PDF

时间:2019-07-03 10:51:43

标签: angular

尝试从api获取pdf时出现上述错误。通话的文字回复如下所示

  

%PDF-1.4↵%äüöß↵20obj↵<

const url = "https://localhost:5001/api/Files/Pdf/497f4c77-1417-485f-8d96-ad198b863e7c?sasToken=..."

openDocWindow(url: string) {

 this._candidateService.openDoc(url).subscribe(res => {
  this.currentDocumentUrl = res;
 });

} 

openDoc(val) {
    const token = this._storeService.getStoredData().access_token;
    const headers = new HttpHeaders()
      .set('Authorization', `Bearer ${token}`)
      .set('Content-Type', 'application/json');
    const options = { headers: headers };
    const url = val;
    return this._http.get<any>(url, options);
}

0 个答案:

没有答案