Home > other >  How to get all headers data from angular http request
How to get all headers data from angular http request

Time:09-01

I m using angular 13. when I send a request from Post Man I get all header information. (image 1)

image 1

Browser also is giving the whole header information (image 2) image 1

Here is my code

return this.http.get(environment.apiUrl   "user/getAllUsers", {observe:'response',params}).pipe(
  map(response => {       
    const paginationHeader = response.headers.get('pagination')

    console.log(response)

    return response;
  })
)

}

But. after sending the request from angular. It just provide me only one data from header which is content type. (image 3)

image 3

I want all header information from request to show in the console. I will be really grateful if anyone help me regarding this problem

CodePudding user response:

You might want to add Access-Control-Expose-Headers in your backend API response.

Please read this

  • Related