AngularJS ignoring some headers

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 00:31:24

I have found an answer to my own question. It's not Angular's fault. The thing is I am using CORS.

I have found such information in CORS documentation:

User agents must filter out all response headers other than those that are a simple response header or of which the field name is an ASCII case-insensitive match for one of the values of the Access-Control-Expose-Headers headers (if any), before exposing response headers to APIs defined in CORS API specifications.

The getResponseHeader() method of XMLHttpRequest will therefore not expose any header not indicated above.

It means that I have to simply add a header Access-Control-Expose-Headers: custom-header.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!