When the read_cache endpoint is hit, it returns data as a stream, but the response middleware used to collect app metrics for synse-server apparently is failing to handle streamed responses correctly
timestamp='2020-06-24T15:02:46.466188Z' logger='sanic.error' level='error' event='Exception occurred in one of response middleware handlers' request_id='6Va5Toht4R3crknzJ6ue2o' exception='Traceback (most recent call last):\n File "/usr/local/lib/python3.8/site-packages/sanic/app.py", line 1016, in handle_request\n response = await self._run_response_middleware(\n File "/usr/local/lib/python3.8/site-packages/sanic/app.py", line 1313, in _run_response_middleware\n _response = middleware(request, response)\n File "/usr/local/lib/python3.8/site-packages/synse_server/app.py", line 77, in on_response\n bytes=len(response.body),\nAttributeError: \'StreamingHTTPResponse\' object has no attribute \'body\''
A check should be added for this case, as well as regression test case(s).
bug noticed by @lazypower
When the
read_cache
endpoint is hit, it returns data as a stream, but the response middleware used to collect app metrics for synse-server apparently is failing to handle streamed responses correctlyA check should be added for this case, as well as regression test case(s).