fix order of operations for when to parse json response

Open
#7 · Created  · Last updated

Description

Currently, when a response with a non-OK error code comes in, the library attempts to parse json, then checks for error codes and then raise an error. This introduces an order of operations bug - you can't parse the response body if there is no response body to parse when a 5xx error is present. Thus, an error is raised from the JSON library, not the expected error from the client. So, the simple solution is to change the order of operations - first, check for errors and raise an exception if a bad response is given, then attempt to parse the body if we haven't raised an exception.

0 attachments

0 comments

Loading commits...