Symbols are returned with a content length

This commit is contained in:
Julien Duponchelle 2017-05-18 16:37:44 +02:00
parent a4245fcf44
commit 189ad994c8
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 2 additions and 1 deletions

View File

@ -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)

View File

@ -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 '</svg>' in response.html
# Reply by the default symbol