Avoid error messages on PayloadTooLarge.

This commit is contained in:
L. Kärkkäinen 2020-03-02 17:06:18 +02:00
parent c2e5674a73
commit cbabe7ec4a

View File

@ -91,8 +91,11 @@ class Http:
if self.request_body: if self.request_body:
if self.response and 200 <= self.response.status < 300: if self.response and 200 <= self.response.status < 300:
logger.error(f"{self.request} body not consumed.") logger.error(f"{self.request} body not consumed.")
try:
async for _ in self: async for _ in self:
pass pass
except PayloadTooLarge:
self.keep_alive = False
# Exit and disconnect if no more requests can be taken # Exit and disconnect if no more requests can be taken
if self.stage is not Stage.IDLE or not self.keep_alive: if self.stage is not Stage.IDLE or not self.keep_alive:
break break