Less code duplication.

This commit is contained in:
Itamar Turner-Trauring 2022-02-04 09:26:25 -05:00
parent 52322c25d3
commit 7454929be0

View File

@ -238,7 +238,7 @@ class StorageClientImmutables(object):
raise ClientException(
response.code,
)
body = loads((yield response.content()))
body = yield _decode_cbor(response)
remaining = RangeMap()
for chunk in body["required"]:
remaining.set(True, chunk["begin"], chunk["end"])
@ -293,8 +293,8 @@ class StorageClientImmutables(object):
url,
)
if response.code == http.OK:
body = yield response.content()
returnValue(set(loads(body)))
body = yield _decode_cbor(response)
returnValue(set(body))
else:
raise ClientException(
response.code,