Andrew
Andrew

Reputation: 7545

Getting all response headers from an api request. Currently not all available

I have an http request where I want some response headers that are, for one reason or another, unavailable to me from the response object but visible in the chrome dev tools enter image description here

But the response object from the javascript request api only contains some of these headers.

{ // response.headers
  cache-control: "no-cache, private",
  content-type: "application/json"
}

Surely, there must be a way to get things like x-ratelimit-limit as part of the response. If it's information sent to the browser, why can't it be available in a javascript http request api?

Upvotes: 0

Views: 546

Answers (1)

Evert
Evert

Reputation: 99523

This looks like a CORS request. If so, response headers are restricted unless the right Access-Control-Allow-Headers header is set. This is for security reasons.

Upvotes: 1

Related Questions