Skip to content

Commit

Permalink
Include query string in cache key
Browse files Browse the repository at this point in the history
PR-URL: #38
Credit: @jpb
Close: #38
Reviewed-by: @isaacs
  • Loading branch information
jpb authored and isaacs committed Dec 8, 2020
1 parent 73cd6d0 commit 1f606e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function cacheKey (req) {
port: parsed.port,
hostname: parsed.hostname,
pathname: parsed.pathname,
search: parsed.search,
})
}`
}
Expand Down
4 changes: 2 additions & 2 deletions test/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ test('put method', (t) => {
data,
cacheOpts
) {
const expectedCacheKey = `make-fetch-happen:request-cache:${HOST}/put-test`
const expectedCacheKey = `make-fetch-happen:request-cache:${HOST}/put-test?a=1`
t.equal(
cacheKey,
expectedCacheKey,
Expand All @@ -229,7 +229,7 @@ test('put method', (t) => {
MockCacache.prototype.put.stream = function putStream () {}
const Cache = mockRequire({ cacache: new MockCacache() })
const cache = new Cache(dir, {})
const req = new Request(`${HOST}/put-test`)
const req = new Request(`${HOST}/put-test?a=1`)
const body = new Minipass()
body.end(CONTENT)
const resOpts = {
Expand Down

0 comments on commit 1f606e7

Please sign in to comment.