Description
It seems that the caching is not working to distinguish between URLs which are only different on the URL params, like it might happen with search parameters. I tried to debug it a little, and it appears that with two URLs which differ only in url parameters, the second URL will overwrite the first, and so when we go back to cacache asking for the first, it won't find it in the cache. So for systems that are based entirely on query parameters the caching fails on the large majority of requests.
So
/a/b/c
/d/e/f
work
but
?a=1&b=3
?a=3&c=4
will fail. Is there a reason that URL params are not added in as part of the cacache key after the URL has been parsed? If they were part of the key this issue would resolve itself naturally. This is the current cachedKey from cache.js and it does not include URL Params. Would it be possible to have those included optionally based on the use case?
function cacheKey (req) {
const parsed = url.parse(req.url)
return `make-fetch-happen:request-cache:${
url.format({
protocol: parsed.protocol,
slashes: parsed.slashes,
host: parsed.host,
hostname: parsed.hostname,
pathname: parsed.pathname
})
}`
}