diff --git a/homeassistant/components/camera/__init__.py b/homeassistant/components/camera/__init__.py index f6b909231ca..49b60183920 100644 --- a/homeassistant/components/camera/__init__.py +++ b/homeassistant/components/camera/__init__.py @@ -35,6 +35,7 @@ from homeassistant.components.stream.const import ( from homeassistant.const import ( ATTR_ENTITY_ID, CONF_FILENAME, + CONTENT_TYPE_MULTIPART, EVENT_HOMEASSISTANT_START, SERVICE_TURN_OFF, SERVICE_TURN_ON, @@ -184,7 +185,7 @@ async def async_get_still_stream(request, image_cb, content_type, interval): This method must be run in the event loop. """ response = web.StreamResponse() - response.content_type = "multipart/x-mixed-replace; boundary=--frameboundary" + response.content_type = CONTENT_TYPE_MULTIPART.format("--frameboundary") await response.prepare(request) async def write_to_mjpeg_stream(img_bytes): diff --git a/homeassistant/components/ffmpeg/__init__.py b/homeassistant/components/ffmpeg/__init__.py index f109103a99c..ca752208f12 100644 --- a/homeassistant/components/ffmpeg/__init__.py +++ b/homeassistant/components/ffmpeg/__init__.py @@ -7,6 +7,7 @@ import voluptuous as vol from homeassistant.const import ( ATTR_ENTITY_ID, + CONTENT_TYPE_MULTIPART, EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, ) @@ -122,9 +123,9 @@ class FFmpegManager: def ffmpeg_stream_content_type(self): """Return HTTP content type for ffmpeg stream.""" if self._major_version is not None and self._major_version > 3: - return "multipart/x-mixed-replace;boundary=ffmpeg" + return CONTENT_TYPE_MULTIPART.format("ffmpeg") - return "multipart/x-mixed-replace;boundary=ffserver" + return CONTENT_TYPE_MULTIPART.format("ffserver") class FFmpegBase(Entity):