Http Response headers missing in chrome, but with Postman they show up

后端 未结 3 1074
别跟我提以往
别跟我提以往 2021-01-02 14:55

When calling my REST Service in Angular, there are no response headers.

Login method in Angular



        
3条回答
  •  情话喂你
    2021-01-02 15:36

    The headers in an HttpResponse object are lazy-loaded, so headers will appear to be empty until you force the values to be loaded. Try calling response.headers.keys() to see all available header names. By the way, this also forces all values to be loaded into the map response.headers.headers.

    Be sure to use headers.get('my-header-name') if you only need to access one particular header value.

提交回复
热议问题