Skip to content

Commit fb49ce3

Browse files
committed
add Do func for client
compatible with http.Client.Do Signed-off-by: roc <roc@imroc.cc>
1 parent 06dc111 commit fb49ce3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

client.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,6 +1484,13 @@ func (c *Client) SetHTTP2WriteByteTimeout(timeout time.Duration) *Client {
14841484
return c
14851485
}
14861486

1487+
// Do is compatible with http.Client.Do, which can make req integration easier
1488+
// in some scenarios.It should be noted that this will make some req features
1489+
// not work properly, such as automatic retry, client middleware, etc.
1490+
func (c *Client) Do(req *http.Request) (*http.Response, error) {
1491+
return c.httpClient.Do(req)
1492+
}
1493+
14871494
// NewClient is the alias of C
14881495
func NewClient() *Client {
14891496
return C()

0 commit comments

Comments
 (0)