We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ad73ed1 + 1a40282 commit 18b23e4Copy full SHA for 18b23e4
1 file changed
src/redfish/rest/v1.py
@@ -249,8 +249,16 @@ def text(self, value):
249
def dict(self):
250
"""Property for accessing the data as an dict"""
251
try:
252
+ if len(self.text) == 0:
253
+ # No response body; return empty dict instead to avoid exceptions
254
+ # No response bodies can be valid in many cases (especially 4XX and 5XX responses)
255
+ return {}
256
return json.loads(self.text)
257
except:
258
+ if self.status == 500:
259
+ # Make an allowance for 500 status codes
260
+ # Depending on the reason for the error, it's possible the web server may not be able to support Redfish handling
261
262
str = "Service responded with invalid JSON at URI {}\n{}".format(
263
self._rest_request.path, self.text)
264
LOGGER.error(str)
0 commit comments