An InstanceResource would overwrite its URI if properties were retrieved or updated on the object. However the URI returned from the API already has '.json' appended to it, so when the library tries to also append .json, the extension has been appended twice. This is a similar bug to #71. I have checked to try and make sure it cannot appear under any other circumstances in the library.
Sometimes the API will return Content-Type: text/html when a 500 server error occurs. This handles this failure case by trying to decode the body as JSON, then throwing a RestException if the json_decode fails. In addition, 500 text/html errors are often transient, and retrying the request will succeed. Modify the TinyHttp client to retry requests one time if they resulted in a 500 error, bringing this library in line with the twilio-ruby library. Add tests for the new decoding behavior. Refactor URI building code in Twilio.php and avoid branching based on whether the query parameters are empty or not.