Search code examples
javascriptgoogle-chromefetchdevtools

Javascript fetch in parallel only after disable cache in devtools


The fetch request in javascript:

async () => {
     try {
       const urls = [
         "http://localhost:3001/foo",
         "http://localhost:3001/foo",
         "http://localhost:3001/foo",
         "http://localhost:3001/foo",
       ];
   
       const requests = urls.map((url) => fetch(url));
       const responses = await Promise.all(requests);
       const errors = responses.filter((response) => !response.ok);
       }
}

I want the request to fire in parallel. But in dev tools in chrome this is shown:

enter image description here

Now when i disable the cache in devtools, it does work in parallel:

enter image description here

enter image description here

Confused on how to make it work without disabling the cache in devtools.

Thanks


Solution

  • Ive found the answer in this post:

    Chrome stalls when making multiple requests to same resource?

    Apparently browsers try to cache requests to the same endpoint.