Skip to content

Commit

Permalink
提供SetTimeout接口,用以设置http请求默认超时时间
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteReimu committed Mar 14, 2024
1 parent 28f4a4a commit 1f2f30f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ func New() *Client {

var std = New()

// SetTimeout 设置http请求超时时间
func SetTimeout(timeout time.Duration) {
std.SetTimeout(timeout)
}
func (c *Client) SetTimeout(timeout time.Duration) {
c.timeout = timeout
}

// GetTimeout 获取http请求超时时间,默认20秒
func GetTimeout() time.Duration {
return std.GetTimeout()
Expand Down

0 comments on commit 1f2f30f

Please sign in to comment.