Description

Transport implements the RoundTripper interface and can be used as a replacement for Go's built in http.Transport implementing end-to-end request timeouts.

transport := &httpclient.Transport{
    ConnectTimeout: 1*time.Second,
    ResponseHeaderTimeout: 5*time.Second,
    RequestTimeout: 10*time.Second,
}
defer transport.Close()

client := &http.Client{Transport: transport}
req, _ := http.NewRequest("GET", "http://127.0.0.1/test", nil)
resp, err := client.Do(req)
if err != nil {
    return err
}
defer resp.Body.Close()

Transport is referenced in 0 repositories