fastapi-cache
fastapi-cache copied to clipboard
Caching not convertible to JSON eg. image/png response type
Would it be possible to cache images with byte response type? If so how? with a custom encoder?
eg with image_tile -> bytes:
`@router.get("/{cog_name}/{z}/{x}/{y}") async def get_cog_tile(cog_name: str, z: int, x: int, y: int, colormap: str = 'terrain') -> Response:
...
headers = {"Content-Encoding": "identity", "content-type": 'image/png'} return Response(content=image_tile, headers=headers) `
Thanks