我正在尝试从后端获取压缩文件。请找到 httpclient 的代码如下:
我在标题中尝试了多个选项,添加了具有不同选项的内容类型。但无法拿出确切的模板。我在 Angular api 中找不到与从服务器获取压缩数据相关的任何内容。请让我知道是否有人会提出类似的问题。
getSpecialHeaders() {
return new HttpHeaders({
'Content-Encoding': 'gzip',
'specialHeader': '',
'Content-Type': 'gzip'
});
}
getAllUnitsReport() {
//Function to get the gzip data
const headersSpl = this.getSpecialHeaders();
//httpoptions with different options tried in content-type and accept encoding
const httpOptions = {
headers : headersSpl };
return this.httpClient.get(envConfig.appURL.assetAdoption, httpOptions)
.catch((error) => {
return Observable.of(error);
});}
http调用成功后我收到如下错误消息:
(未知 url)的 Http 失败响应:0 未知错误