isomorphic-fetch icon indicating copy to clipboard operation
isomorphic-fetch copied to clipboard

Problem with accessing headers value

Open tutok opened this issue 8 years ago • 6 comments

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

image

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

tutok avatar Jun 09 '16 20:06 tutok

I am having the same issue in the AOSP browser. Works in chrome and FF though. Any insight would be greatly appreciated.

fedgrant avatar Jul 07 '16 15:07 fedgrant

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

fuglu avatar Jul 27 '16 16:07 fuglu

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?

AlexChesters avatar Oct 11 '16 21:10 AlexChesters

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.

AlexChesters avatar Oct 11 '16 21:10 AlexChesters

Same resolution as @fuglu https://github.com/matthew-andrews/isomorphic-fetch/issues/115

carlosconnected avatar Dec 01 '16 20:12 carlosconnected

@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.

betoharres avatar Jun 19 '17 20:06 betoharres