diff --git a/gns3server/web/response.py b/gns3server/web/response.py index 7b3e287a..d786b874 100644 --- a/gns3server/web/response.py +++ b/gns3server/web/response.py @@ -120,7 +120,7 @@ class Response(aiohttp.web.Response): st = os.stat(path) self.last_modified = st.st_mtime - self.enable_chunked_encoding() + self.headers[aiohttp.hdrs.CONTENT_LENGTH] = str(st.st_size) with open(path, 'rb') as fobj: yield from self.prepare(self._request) diff --git a/tests/handlers/api/controller/test_symbol.py b/tests/handlers/api/controller/test_symbol.py index e44a0489..cd6f15b2 100644 --- a/tests/handlers/api/controller/test_symbol.py +++ b/tests/handlers/api/controller/test_symbol.py @@ -36,6 +36,7 @@ def test_get(http_controller): response = http_controller.get('/symbols/' + urllib.parse.quote(':/symbols/firewall.svg') + '/raw') assert response.status == 200 assert response.headers['CONTENT-TYPE'] == 'image/svg+xml' + assert response.headers['CONTENT-LENGTH'] == '9381' assert '' in response.html # Reply by the default symbol