From 9c917117407c18c6226f1ef587569f808a6cee6b Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Mon, 26 Sep 2016 04:00:23 +0200 Subject: [PATCH] Possibly fix image sending bug --- app_service.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app_service.py b/app_service.py index 0e5054d..6a62f55 100644 --- a/app_service.py +++ b/app_service.py @@ -175,13 +175,11 @@ async def _matrix_request(method_fun, category, path, user_id, data=None, content_type=None): # pylint: disable=too-many-arguments # Due to this being a helper function, the argument count acceptable - buffer = None if data is not None: if isinstance(data, dict): - buffer = json.dumps(data) + data = json.dumps(data) content_type = 'application/json; charset=utf-8' elif content_type is None: - buffer = data content_type = 'application/octet-stream' params = {'access_token': AS_TOKEN} @@ -190,7 +188,7 @@ async def _matrix_request(method_fun, category, path, user_id, data=None, async with method_fun('{}_matrix/{}/r0/{}' .format(MATRIX_HOST, quote(category), quote(path)), - params=params, data=buffer, + params=params, data=data, headers={'Content-Type': content_type}) as response: if response.headers['Content-Type'].split(';')[0] \ == 'application/json':