Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix UnboundLocalError in post_urlencoded_get_json #4460

Merged
merged 1 commit into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/4460.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix UnboundLocalError in post_urlencoded_get_json
5 changes: 3 additions & 2 deletions synapse/http/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,10 @@ def post_urlencoded_get_json(self, uri, args={}, headers=None):
"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)

Expand Down