I am trying to get the response header details from a failed call to Google Endpoints using Axios. There was an exception in Google Endpoints due to rate limit exceeded (status code 429) and I'm trying to access that status code from the client side.
When I open devtools I can see that the status header is present, but after many tries I am unable to access this header with javascript (using Axios). If I log the error there are no response headers at all.
My issue is similar to this one: Axios get access to response header fields but it looks like their call succeeded since they are logging the response in the "then" block. However mine fails due to CORS and there is no "response.headers" object at all in the caught error in Axios.
When I parse and log the Axios error response in the console I only see the config for the request and there are no response headers to be found at all:
I also have added "Access-Control-Expose-Headers: status, server" to Google Endpoints to expose the "status" and "server" headers as per the accepted answer of the above post but nothing has changed.
EDIT: I also tried using an Axios interceptor to get the raw response from the server and it is undefined. There is no response at all from Google Endpoints. I'm confused why I can see the status in dev tools but there is no way to access it in the client app.