Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Nov 6, 2024
1 parent ea5e09c commit b979a27
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/handler/cache-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,16 @@ class CacheHandler extends DecoratorHandler {
const headers = util.parseHeaders(rawHeaders)

const cacheControlHeader = headers['cache-control']
const contentLengthHeader = headers['content-length']

if (!cacheControlHeader || !contentLengthHeader || this.#store.isFull) {
// Don't have the headers we need, can't cache
if (!cacheControlHeader || typeof cacheControlHeader !== 'string') {
// Don't have cache-control, can't cache.
return downstreamOnHeaders()
}

const contentLength = Number(contentLengthHeader)
const contentLengthHeader = headers['content-length']
const contentLength = contentLengthHeader ? Number(contentLengthHeader) : null
if (!Number.isInteger(contentLength)) {
// Don't know the final size, don't cache.
// TODO (fix): Why not cache?
return downstreamOnHeaders()
}

Expand Down

0 comments on commit b979a27

Please sign in to comment.