mirror of
https://git.dn42.dev/dn42/registry.git
synced 2025-07-19 08:56:59 +08:00
fix json decode issue
This commit is contained in:
parent
115a39f2b0
commit
28d12eb224
3 changed files with 6 additions and 13 deletions
|
@ -374,7 +374,10 @@ def http_get(server, url, query=None, headers=None):
|
|||
if "application/json" in req.getheader("Content-Type", "application/json"):
|
||||
if req.status > 299:
|
||||
return {}
|
||||
return json.loads(req.read())
|
||||
r = req.read()
|
||||
if not isinstance(r, str):
|
||||
r = r.decode("utf-8")
|
||||
return json.loads(r)
|
||||
|
||||
if req.status > 299:
|
||||
return ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue