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: treat cache-control request header case-insensitively #4131

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Apr 1, 2025

Closes #3904

This relates to...

Rationale

Changes

Features

N/A

Bug Fixes

Breaking Changes and Deprecations

N/A

Status

@@ -319,8 +319,9 @@ module.exports = (opts = {}) => {
return dispatch(opts, handler)
}

const reqCacheControl = opts.headers?.['cache-control']
? parseCacheControlHeader(opts.headers['cache-control'])
const rawReqCacheControl = normaliseHeaders(opts)['cache-control']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For cache hits, normaliseHeaders() will be called three times (here, and in handleResult(), and in makeCacheKey()).

Would it be preferable to do that once? E.g. mutating or recreating opts here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that'd be better.

@alxndrsn alxndrsn marked this pull request as ready for review April 2, 2025 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache interceptor does not process capitalized Cache-Control header in request
2 participants