Skip to content

Commit

Permalink
feat: Add RoundTripper method to Client
Browse files Browse the repository at this point in the history
  • Loading branch information
presbrey committed Aug 10, 2024
1 parent 8560362 commit 6b39f00
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions multiproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,16 @@ func (c *Client) Head(url string) (*http.Response, error) {
}
return c.Do(req)
}

// RoundTripper returns an http.RoundTripper that uses the Client's proxies.
func (c *Client) RoundTripper() http.RoundTripper {
return &clientRoundTripper{client: c}
}

type clientRoundTripper struct {
client *Client
}

func (rt *clientRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
return rt.client.do(req)
}

0 comments on commit 6b39f00

Please sign in to comment.