Add cache headers to picture integration (#39402)

This commit is contained in:
Paulus Schoutsen 2020-08-31 09:25:39 +02:00 committed by GitHub
parent b71cbd2033
commit 4688171ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,7 @@ from aiohttp import hdrs, web
from aiohttp.web_request import FileField
import voluptuous as vol
from homeassistant.components.http.static import CACHE_HEADERS
from homeassistant.components.http.view import HomeAssistantView
from homeassistant.const import CONF_ID
from homeassistant.core import HomeAssistant, callback
@ -197,7 +198,8 @@ class ImageServeView(HomeAssistantView):
)
return web.FileResponse(
target_file, headers={hdrs.CONTENT_TYPE: image_info["content_type"]}
target_file,
headers={**CACHE_HEADERS, hdrs.CONTENT_TYPE: image_info["content_type"]},
)