resty icon indicating copy to clipboard operation
resty copied to clipboard

implement `SetTimeout` without touching http.Client.Timeout

Open okhowang opened this issue 3 years ago • 3 comments
trafficstars

currently SetTimeout just modify http.Client.Timeout

func (c *Client) SetTimeout(timeout time.Duration) *Client {
	c.httpClient.Timeout = timeout
	return c
}

when we create resty.Client with NewWithClient. it do side effect if we use http.Client in other code. maybe we should keep timeout in resty.Client, and do context.WithTimeout before every request?

okhowang avatar Jun 07 '22 12:06 okhowang

+1

yunduan16 avatar Jun 23 '22 11:06 yunduan16

https://github.com/go-resty/resty/issues/574

aadog avatar Aug 24 '22 08:08 aadog

I implemented session pattern, you can use

aadog avatar Aug 24 '22 08:08 aadog