I can only get content type header.
I use other client like axios, it contains all headers like date etc.
I'm calling from chrome extension, any thoughts? thanks.
How are you verifying which of the headers are you getting back? It seems strange that you can only access a single response header. Can you show us some example code?
Also, keep in mind that if you're using Chrome, you're not using this polyfill. Chrome has its own native implementation of fetch, so if there's a bug in it, we can't help.
@naivefun, I'm sure you've figured it out by now, but for anyone else with the same issue - it's likely because your CORS headers aren't set correctly on the server.
If you're using, say, koa-cors, your config might look something like this:
app.use(koaCors({
origin: true,
credentials: true,
expose: ['Some-Custom-Header'], // <-- this is what you need
}));
I also had this problem. Turns out it for me was CORS also, as @leebenson mentioned could be a reason.
I am using .NET Core and had to add
app.UseCors(builder => builder.AllowAnyOrigin()
.WithExposedHeaders("Content-Disposition") <---- this
);
Most helpful comment
@naivefun, I'm sure you've figured it out by now, but for anyone else with the same issue - it's likely because your CORS headers aren't set correctly on the server.
If you're using, say,
koa-cors, your config might look something like this: