summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2019-01-24 13:38:29 +0000
committerGitHub <noreply@github.com>2019-01-24 13:38:29 +0000
commitf4697b5ec1071905b1177fd473e20df0b1455a4c (patch)
treeafb42e9edaad1811f1649b06a6ae3208fb86c07d /synapse
parentMerge pull request #4435 from matrix-org/neilj/fix_threepid_auth_check (diff)
downloadsynapse-f4697b5ec1071905b1177fd473e20df0b1455a4c.tar.xz
Fix UnboundLocalError in post_urlencoded_get_json (#4460)
This could cause exceptions if the id server returned 4xx responses.
Diffstat (limited to 'synapse')
-rw-r--r--synapse/http/client.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index afcf698b29..47a1f82ff0 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -333,9 +333,10 @@ class SimpleHttpClient(object):
             "POST", uri, headers=Headers(actual_headers), data=query_bytes
         )
 
+        body = yield make_deferred_yieldable(readBody(response))
+
         if 200 <= response.code < 300:
-            body = yield make_deferred_yieldable(treq.json_content(response))
-            defer.returnValue(body)
+            defer.returnValue(json.loads(body))
         else:
             raise HttpResponseException(response.code, response.phrase, body)