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
|
@ -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…
Reference in New Issue