Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cache #3804

Merged
merged 17 commits into from
Nov 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP
  • Loading branch information
ronag committed Nov 6, 2024
commit ea5e09c9ec8ce1827068fd90f4e8e8f9d6f2b156
12 changes: 4 additions & 8 deletions lib/handler/cache-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class CacheHandler extends DecoratorHandler {
} catch {
// Fail silently
}

return downstreamOnHeaders()
}

Expand Down Expand Up @@ -138,18 +137,15 @@ class CacheHandler extends DecoratorHandler {
if (this.#writeStream) {
this.#writeStream.on('drain', resume)
this.#writeStream.on('error', () => {
// TODO (fix): Make this error somehow observable?
// TODO (fix): Make error somehow observable?
this.#writeStream = undefined
// TODO (fix): Should we resume even if was paused downstream?
resume()
})
}
}

if (typeof this.#handler.onHeaders === 'function') {
return downstreamOnHeaders()
}

return false
return downstreamOnHeaders()
}

/**
Expand Down Expand Up @@ -330,7 +326,7 @@ function stripNecessaryHeaders (rawHeaders, parsedHeaders, cacheControlDirective
for (let i = 0; i < headerNames.length; i++) {
const header = headerNames[i]

if (headersToRemove.indexOf(header) !== -1) {
if (headersToRemove.includes(header)) {
// We have a at least one header we want to remove
if (!strippedHeaders) {
// This is the first header we want to remove, let's create the object
Expand Down
Loading