twilio/twilio-php — pull request #77 by kevinburke (2012-07-31 11:58:58+00:00)
Title: Retry 1 time if 500, and better Content-type check

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.