isomorphic-fetch
isomorphic-fetch copied to clipboard
Problem with accessing headers value
I have problem with accessing headers value. I can only read value of content-type
. Am I doing something wrong?
I have code like this
return fetch(url)
.then(response => {
debugger;
console.log(response.headers.get('Content-Type'))
console.log(response.headers.get('Date'))
return response;
})
.then(processStatus);
which prints:
application/json; charset=utf-8
null
I have es6-promise
installed, also added import "babel-polyfill";
on beginning of my scripts.
I am using latest version which is 2.2.1
I am having the same issue in the AOSP browser. Works in chrome and FF though. Any insight would be greatly appreciated.
We ran into the same issue today and fixed it by adding Location to the Access-Control-Expose-Headers: http://www.aaron-powell.com/posts/2013-11-28-accessing-location-header-in-cors-response.html
I'm also seeing this, inspecting the network call I can see 7 response headers but using isomorphic-fetch
I can only get the Content-Type
header. Is this intentional?
My above issue was resolved in the same way as @fuglu. I had to add the header I was trying to access to the Access-Control-Expose-Headers
header.
Same resolution as @fuglu https://github.com/matthew-andrews/isomorphic-fetch/issues/115
@fuglu what's the point to set Location
HTTP header in this case? I don't want to set a HTTP redirect nor I created something to define this variable, this is doesn't make any sense to me :(
also the solution didn't work using it with electron.