Angular无法从HttpEvent标题中获取ETag头
创始人
2024-10-30 00:33:04
0

可以在http请求中添加headers选项,将ETag头手动添加到请求头中。

示例代码:

import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';

@Injectable()
export class DataService {
  private serviceUrl = 'http://example.com/api/data';

  constructor(private http: HttpClient) {}

  getData(id: number): Observable> {
    const headers = new HttpHeaders({
        'ETag': 'your ETag value'
    });

    return this.http.get(this.serviceUrl + '/' + id, { headers, observe: 'response' });
  }
}

相关内容

热门资讯

第1分钟阶段!wepoker科... 第1分钟阶段!wepoker科技辅助器(透视)一直有辅助安装(哔哩哔哩)1、超多福利:超高返利,海量...
3分钟总结!hhpoker可以... 3分钟总结!hhpoker可以控制牌吗(透视)本来是真的有辅助工具(哔哩哔哩)1、任何hhpoker...
四分钟项目!wpk模拟器(透视... 四分钟项目!wpk模拟器(透视)切实是真的有辅助插件(哔哩哔哩)亲,关键说明,wpk模拟器透视脚本安...
十分钟举措!aa poker辅... 十分钟举措!aa poker辅助(透视)都是是有辅助插件(哔哩哔哩)1、aa poker辅助公共底牌...
第2分钟演示!hhpoker底... 第2分钟演示!hhpoker底牌透视脚本(透视)好像真的有辅助开挂(哔哩哔哩)1、每一步都需要思考,...
六分钟方针!wepoker黑侠... 六分钟方针!wepoker黑侠破解(透视)切实是真的有辅助安装(哔哩哔哩)1、wepoker黑侠破解...
第1分钟阶段!fishpoke... 第1分钟阶段!fishpoker透视底牌(透视)其实有辅助辅助(哔哩哔哩)1、fishpoker透视...
六分钟技法!we-poker辅... 六分钟技法!we-poker辅助器(透视)其实存在有辅助神器(哔哩哔哩)1、we-poker辅助器免...
九分钟教程书!aapoker安... 九分钟教程书!aapoker安装包怎么使用(透视)果然是真的有辅助辅助(哔哩哔哩)1、实时aapok...
第四分钟策略!pokemmo辅... 第四分钟策略!pokemmo辅助器手机版下载(透视)总是真的有辅助透视(哔哩哔哩)1、很好的工具软件...