diff --git a/aiogram/bot/api.py b/aiogram/bot/api.py index 13ff07e7..7705e52a 100644 --- a/aiogram/bot/api.py +++ b/aiogram/bot/api.py @@ -50,6 +50,9 @@ async def _check_result(method_name, response): body = await response.text() log.debug(f"Response for {method_name}: [{response.status}] {body}") + if response.content_type != 'application/json': + raise exceptions.NetworkError(f"Invalid response with content type {response.content_type}: \"{body}\"") + try: result_json = await response.json(loads=json.loads) except ValueError: