fix headers if cache encoder return custom response

This commit is contained in:
yann-dubrana
2024-08-07 13:25:05 +02:00
committed by GitHub
parent 567934300b
commit 292c098cc7

View File

@@ -221,7 +221,8 @@ def cache(
return response return response
result = cast(R, coder.decode_as_type(cached, type_=return_type)) result = cast(R, coder.decode_as_type(cached, type_=return_type))
if isinstance(result, Response):
result.headers.update(response.headers)
return result return result
inner.__signature__ = _augment_signature(wrapped_signature, *to_inject) # type: ignore[attr-defined] inner.__signature__ = _augment_signature(wrapped_signature, *to_inject) # type: ignore[attr-defined]