axios: Response headers missing
I’m trying to check if X-Medusa-Server is set but I’m only getting a single header back.
axios.post('/auth/login')).then(function (response) {
console.log(response.headers);
});
The above code returns {"content-type": "application/json; charset=UTF-8"}
where as I expect the other headers that I can see in the network tab as listed below.
HTTP/1.1 200 OK
Content-Length: 46
Access-Control-Allow-Methods: POST, OPTIONS
X-Medusa-Server: v0.1.8.1
Vary: Accept-Encoding
Server: TornadoServer/4.3
Date: Mon, 19 Dec 2016 07:22:14 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token, X-Api-Key
Content-Type: application/json; charset=UTF-8
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 8
- Comments: 25 (3 by maintainers)
All right. This might be the problem: http://stackoverflow.com/questions/37897523/axios-get-access-to-response-header-fields
Found here: https://github.com/mzabriskie/axios/issues/467#issuecomment-252076410
What version of axios are you using? I just tried this with RunKit and received all the headers.
https://runkit.com/585998a881a05a001491eb0b/585998a881a05a001491eb0c
I’m running in the same issue, but when i make the same request with postman, i get access to all headers, when i do it trough code, i don’t. i don’t see how that would be cors related?
@rubennorte In README add a small description and a link to https://github.com/mzabriskie/axios/issues/467#issuecomment-252076410 . Something like this:
Then you kill multiple birds with one stone: you educate people about CORS, prevent further questions about CORS in issues, become more awesome overall 😃
I m still experiencing this issue. Any fix?
Hit this issue uploading objects to S3 and expecting the etag in response headers.
Resolved by updating the S3 Bucket CORS config to include:
Use Access-Control-Expose-Headers.
For example in NodeJS. cors({ origin: [ “http://localhost”, “http://localhost:8080”, “http://localhost:8081”, “*” ], credentials: true, exposedHeaders: [‘Access-Control-Allow-Origin’, ‘Vary’, ‘Content-Length’] })
But, Set-Cookie header might not work.
Reference
Why was this issue closed?
I’m facing this issue.
Then I change to use node-fetch and I get the all headers supposed to see.