0

I am trying to get my web-page to cache the below request because I do not think it will change very often. I read that to control caching one can set the Cache-Control header, but when I did it below and check in Chrome -> Dev Tools ->Application -> Cache the cache is empty.

   var myHeaders = new Headers();
   myHeaders.append('Cache-Control', 'max-age=345600;');

   var requestOptions = {
    method: 'GET',
    redirect: 'follow',
    headers : myHeaders
  };


  try {
    const response = await fetch("https://api.covid19api.com/countries", requestOptions);
    const json = await response.json();   
Jan Schultke
  • 17,446
  • 6
  • 47
  • 96
Alex
  • 303
  • 1
  • 9

0 Answers0