jmcvetta/restclient — pull request #3 by arvida (2013-04-14 16:21:57+00:00)
Title: Export default client variable

Exposing the default client variable makes it possible to access restclient's `http.Client`.
With access to this you could stub responses by setting a custom `http.Transport` interface in your tests with something like this:

```go
type FakeTransport struct {
http.Transport
}

func (m *FakeTransport) RoundTrip(req *http.Request) (*http.Response, error){
response := new(http.Response)
response.StatusCode = 200
response.Body = body_for(req.URL)

return response, nil
}

...

restclient.DefaultClient.HttpClient.Transport = my_fake_transport
```

---

I am really new to Go and was looking into request stubbing when starting to write a API client using restclient. I think this is kind of a nice way to do that without having to use `net/http/httptest` when you just want to stub a response.

Atleast it can be good to allow access to restclient's `http.Client` as it is configurable. Maybe there is a better way to do this? :blush:

Anyway, let me know what you think!