I'm writing a react-native app, and I'm polling from an API that supports the If-Modified-Since
header.
My request is:
const response = await fetch(
uri,
{
method: 'GET',
cache: 'no-store',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `token ${token}`,
'If-Modified-Since': lastUpdatedAt.toUTCString(),
},
}
);
Now, the problem is that this request will always return a response.status
equal to 200
, while if I run the same request with CURL:
curl -s -o dev/null -w "%{http_code}" $uri -H "If-Modified-Since: Mon, 27 Nov 2017 11:36:41 GMT"
It will, correctly, return 304
.
What am I doing wrong? Do I have to set any additional option?