DMTF / Redfish-Protocol-Validator

The Redfish Protocol Validator tests the HTTP protocol behavior of a Redfish service to validate that it conforms to the Redfish specification.
Other
14 stars 12 forks source link

Invalid JSON responses crash tool #40

Closed jautor closed 6 months ago

jautor commented 2 years ago

Testing an implementation which has a bug that produces an invalid JSON payload, the tool crashes due with JSONDecodeError. This makes it difficult to debug since the traceback doesn't provide the URI. Tool should check/catch basic JSON decode faults and display an output that includes the URI of the faulty payload.

mraineri commented 2 years ago

Unfortunately this will take a bit of work since the tool is assuming valid JSON is returned on 200 OK responses. It's using the built-in json method to automatically extract the response contents almost everywhere.

Wrapping the entire tool to catch the exception will also lose context in terms of which URI is the offending one.