sfreiberg/gotwilio — pull request #9 by metcalf (2014-12-05 20:12:15+00:00)
Title: Support overriding the default HTTP client for Twilio requests.

Currently, every request uses a fresh, default http.Client. This prevents users from customizing the HTTP client behavior by e.g. setting a timeout or configuring a proxy.

The proposed change adds an HTTPClient field to the Twilio struct to allow users to specify a custom client. If no client is specified, it defaults to the built-in http.DefaultClient instead of allocating a fresh zero-valued http.Client for each request.

Note that in order to ensure compatibility for users who don't make use of `NewTwilioClient` we have to guard against the case where no HTTPClient is set in the `post` method.