Android 反应本机+;Expo-fetch缓存控制
我正在使用react native expo与redux集成构建android应用程序。使用fetch方法调用API,但始终显示缓存的结果。 缓存控制标头与请求不匹配。 我尝试了两种类型的标题定义Android 反应本机+;Expo-fetch缓存控制,android,react-native,fetch,expo,cache-control,Android,React Native,Fetch,Expo,Cache Control,我正在使用react native expo与redux集成构建android应用程序。使用fetch方法调用API,但始终显示缓存的结果。 缓存控制标头与请求不匹配。 我尝试了两种类型的标题定义 var myHeaders = new Headers(); myHeaders.set('Accept', 'application/json'); myHeaders.set('Content-Type', 'application/json'); myHeaders.set('Cache
var myHeaders = new Headers();
myHeaders.set('Accept', 'application/json');
myHeaders.set('Content-Type', 'application/json');
myHeaders.set('Cache-Control', 'no-cache');
fetch(
"http://192.168.1.71:3000/", {
method: 'GET',
headers: myHeaders
})
.then(response => console.log(response)).catch(err=>console.log(err));
及
但每次服务器中的request.headers都会显示以下内容:
{ accept: 'application/json',
'content-type': 'application/json; charset=utf-8',
host: '192.168.1.71:3000',
connection: 'Keep-Alive',
'accept-encoding': 'gzip',
'user-agent': 'okhttp/3.12.1' }
服务器端没有缓存控制。我做错什么了吗?可能重复:也可以在expo客户端中不进行调试的情况下进行尝试
{ accept: 'application/json',
'content-type': 'application/json; charset=utf-8',
host: '192.168.1.71:3000',
connection: 'Keep-Alive',
'accept-encoding': 'gzip',
'user-agent': 'okhttp/3.12.1' }