Neoteroi / BlackSheep

Fast ASGI web framework for Python
https://www.neoteroi.dev/blacksheep/
MIT License
1.8k stars 75 forks source link

uvicorn complains when chunked response does not include closing message #373

Closed RobertoPrevato closed 1 year ago

RobertoPrevato commented 1 year ago

Describe the bug When a response content is chunked and the last chunk is not empty, currently blacksheep does not send a final message such as:

  await send({
      'type': 'http.response.body',
      'body': b"",
      'more_body': False
  })

Which results in uvicorn complaining, even when the response is transmitted properly to the client, with message:

ERROR:    ASGI callable returned without completing response.

To fix, ensure that a final message with "body": b"" is transmitted to the ASGI server.