jhiesey / stream-http

Streaming node http in the browser
MIT License
354 stars 62 forks source link

option to disable cache #97

Open jimmywarting opened 6 years ago

jimmywarting commented 6 years ago

Cache is useful, but i don't wish for it to be set in stone if it should be enabled or disabled

Full context here: https://stackoverflow.com/questions/52349984/chrome-cors-requests-are-faster-when-cache-is-disabled

Another explanation of the problem here: https://stackoverflow.com/questions/27513994/chrome-stalls-when-making-multiple-requests-to-same-resource

with fetch you can set the cache option like so:

fetch(url, { cache: default || reload || no-cache }

when falling back to XMLHttpRequest you would have to add the header

'cache-control': 'no-cache, no-store'