gpt4 book ai didi

Angular HttpClient : Property 'headers' does not exist on type 'Blob'

转载 作者:行者123 更新时间:2023-12-05 01:43:21 24 4
gpt4 key购买 nike

<分区>

我正在使用 angular 5,这是我从服务器下载文件的代码:

1- 服务:

export(url) {
return this.http.get(url, {responseType: 'blob'});

2-组件代码:

  public downloadfile(file: any) {

var resp: any;
this.documentsService.export('http://localhost:55650/api/files/attachment/' + file.docf_GUID)
.subscribe(
(data) =>{
resp = data, saveAs(resp), console.log(resp.headers) },
() => { }
);
}

但是当我尝试获取响应 header 时出现此错误:

error TS2339: Property 'headers' does not exist on type 'Blob'.

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com