mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 15:26:10 -04:00
Fix UnboundLocalError in post_urlencoded_get_json (#4460)
This could cause exceptions if the id server returned 4xx responses.
This commit is contained in:
parent
10b89d5c2e
commit
f4697b5ec1
2 changed files with 4 additions and 2 deletions
1
changelog.d/4460.bugfix
Normal file
1
changelog.d/4460.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix UnboundLocalError in post_urlencoded_get_json
|
|
@ -333,9 +333,10 @@ class SimpleHttpClient(object):
|
||||||
"POST", uri, headers=Headers(actual_headers), data=query_bytes
|
"POST", uri, headers=Headers(actual_headers), data=query_bytes
|
||||||
)
|
)
|
||||||
|
|
||||||
|
body = yield make_deferred_yieldable(readBody(response))
|
||||||
|
|
||||||
if 200 <= response.code < 300:
|
if 200 <= response.code < 300:
|
||||||
body = yield make_deferred_yieldable(treq.json_content(response))
|
defer.returnValue(json.loads(body))
|
||||||
defer.returnValue(body)
|
|
||||||
else:
|
else:
|
||||||
raise HttpResponseException(response.code, response.phrase, body)
|
raise HttpResponseException(response.code, response.phrase, body)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue