kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
fix: ky caching during tests
rodzic
3a6fc532d0
commit
2c1266d277
|
@ -92,6 +92,7 @@ export function createTestKyInstance(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(await keyv.has(cacheKey))) {
|
if (!(await keyv.has(cacheKey))) {
|
||||||
|
// console.log('cache miss', cacheKey)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,19 +138,18 @@ export function createTestKyInstance(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contentType !== 'application/json') {
|
if (!contentType?.includes('application/json')) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const cacheKey = getCacheKeyForRequest(request)
|
const cacheKey = getCacheKeyForRequest(request)
|
||||||
// console.log({ cacheKey })
|
// console.log({ cacheKey })
|
||||||
if (!cacheKey) {
|
if (!cacheKey) {
|
||||||
console.log('222')
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const responseBody = await response.json()
|
const responseBody = await response.json()
|
||||||
// console.log({ responseBody })
|
// console.log({ cacheKey, responseBody })
|
||||||
|
|
||||||
await keyv.set(cacheKey, responseBody)
|
await keyv.set(cacheKey, responseBody)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Ładowanie…
Reference in New Issue