Skip to content

Guard against nil response headers in cache invalidation#143

Open
SAY-5 wants to merge 1 commit into
sourcelevel:masterfrom
SAY-5:fix-delete-nil-headers
Open

Guard against nil response headers in cache invalidation#143
SAY-5 wants to merge 1 commit into
sourcelevel:masterfrom
SAY-5:fix-delete-nil-headers

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jun 18, 2026

Copy link
Copy Markdown

Fixes #142. When an upstream request fails in a way that yields a response with nil headers (timeout, TCP reset), delete raised NoMethodError: undefined method '[]' for nil while looking up the Location and Content-Location headers, and that bubbled out of the on_complete callback instead of just invalidating the request url.

This skips the header lookup when headers are nil and still deletes the cache entry for the request url. Added a spec that drives delete with a headerless response.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
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.

NoMethodError: undefined method '[]' for nil in HttpCache#delete when response has nil headers

1 participant