[英]Angular8 get full of HttpClient response headers
I'm using HttpClient to request a json
file.我正在使用 HttpClient 请求一个
json
文件。 I want the file can be cached with ETag
.我希望文件可以用
ETag
缓存。 But it not works.但它不起作用。 I think that The
If-None-Match
not send to the server is the reason.我认为
If-None-Match
没有发送到服务器是原因。 So I want to get The 'ETag' from response headers.所以我想从响应头中获取“ETag”。 But the response header not has the item in Angular, But It's truly in the HTTP response in chrome network tool.
但是响应头没有Angular中的项目,但它确实在chrome网络工具中的HTTP响应中。 All of showing in follow images.
所有显示在以下图像中。
How can I get the ETag from response Header如何从响应头中获取 ETag
I think it's similar to this : HttpClient dont return all headers .我认为它与此类似: HttpClient 不返回所有标头。
You need to setup your backend to return Access-Control-Expose-Headers:ETag
.您需要设置后端以返回
Access-Control-Expose-Headers:ETag
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.