From 1f2f30f35ff07201675a3121cfc7a015d061dc9f Mon Sep 17 00:00:00 2001 From: CuteReimu <415551921@qq.com> Date: Thu, 14 Mar 2024 19:30:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BE=9BSetTimeout=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BB=A5=E8=AE=BE=E7=BD=AEhttp=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E9=BB=98=E8=AE=A4=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client.go b/client.go index 55d8ccb..209d5ce 100644 --- a/client.go +++ b/client.go @@ -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()