builder: properly decode the http response body

What is returned by content.decode() is a binary string and needs
to be properly decoded before we use it, especially in the error
messages.
This commit is contained in:
Christian Kellner 2020-09-19 11:19:17 +02:00
parent 807a4937ee
commit 3342f88f3b

View file

@ -178,7 +178,7 @@ class Client:
res = self.http.post(url, json=cro.as_dict())
if res.status_code != 201:
body = res.content.strip()
body = res.content.decode("utf-8").strip()
msg = f"Failed to create the compose request: {body}"
raise koji.GenericError(msg) from None
@ -192,7 +192,7 @@ class Client:
res = self.http.get(url)
if res.status_code != 200:
body = res.content.strip()
body = res.content.decode("utf-8").strip()
msg = f"Failed to get the compose status: {body}"
raise koji.GenericError(msg) from None