Skip to content

Commit

Permalink
http: log unexpected json response
Browse files Browse the repository at this point in the history
If we our JSON response is not a dict or a list,
we will now log to better debug potential issues
of this unexpected response
  • Loading branch information
lucasmoura authored and orndorffgrant committed Oct 23, 2024
1 parent 9de2265 commit 8f3e081
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions uaclient/http/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ def readurl(
json_dict = json_body
elif isinstance(json_body, list):
json_list = json_body
else:
LOG.warning("unexpected JSON response: %s", str(json_body))

sorted_header_str = ", ".join(
["'{}': '{}'".format(k, resp.headers[k]) for k in sorted(resp.headers)]
Expand Down Expand Up @@ -453,6 +455,8 @@ def unix_socket_request(
json_dict = json_body
elif isinstance(json_body, list):
json_list = json_body
else:
LOG.warning("unexpected JSON response: %s", str(json_body))

return HTTPResponse(
code=resp.status,
Expand Down

0 comments on commit 8f3e081

Please sign in to comment.