2

I have the following:

  const accessToken = await getAccessToken()
  const opt: any = {
    method,
    headers: {
      Authorization: `Bearer ${accessToken}`,
    },
    ...(data && { body: data }),
  }

  return fetch(`${basePath}${path}`, opt).then(
    res => {
      console.log(res.headers.get('ETag')) // null

      return res.json()
    }
  )
}

and although I can see the value of the ETag in the network tab here its value is null?

I would need that value to be able to do a POST, is there a way to get it or is this a wrong approach?

Aessandro
  • 5,517
  • 21
  • 66
  • 139
  • 4
    Is this a CORS request? Then you’ll probably have to allow access to these kinds of headers first, see https://stackoverflow.com/a/38975988/10955263 and https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers – 04FS Feb 03 '20 at 09:16
  • Hi yes it's a CORS – Aessandro Feb 03 '20 at 09:17
  • Why would you need the ETag value for a POST request? – Bergi Feb 03 '20 at 09:22

0 Answers0