From 3c4bb861147afb65fa83a95a91d3148cc0b816f8 Mon Sep 17 00:00:00 2001 From: Gerrod Ubben Date: Thu, 7 May 2026 22:20:26 -0400 Subject: [PATCH] Fix Content-Type header for cached ApiResponse (cherry picked from commit 84a6c2e6d9e615bf6de7b58531cd749d557f3c68) --- CHANGES/+cache_api_response_content_type.bugfix | 1 + pulpcore/cache/cache.py | 1 + 2 files changed, 2 insertions(+) create mode 100644 CHANGES/+cache_api_response_content_type.bugfix diff --git a/CHANGES/+cache_api_response_content_type.bugfix b/CHANGES/+cache_api_response_content_type.bugfix new file mode 100644 index 00000000000..314dc5afa06 --- /dev/null +++ b/CHANGES/+cache_api_response_content_type.bugfix @@ -0,0 +1 @@ +Fixed cache forgetting the Content-Type header of ApiResponses diff --git a/pulpcore/cache/cache.py b/pulpcore/cache/cache.py index 637bda94e12..4fdaf7d691f 100644 --- a/pulpcore/cache/cache.py +++ b/pulpcore/cache/cache.py @@ -217,6 +217,7 @@ def make_entry(self, key, base_key, handler, args, kwargs, expires=DEFAULT_EXPIR entry["type"] = "FileResponse" elif isinstance(response, ApiResponse): entry["data"] = response.data + entry["content_type"] = response.content_type entry["type"] = "APIResponse" elif isinstance(response, HttpResponse): entry["content"] = response.content.decode("utf-8")