diff options
author | brian-armstrong-discord <brian.armstrong@discordapp.com> | 2022-11-03 13:25:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-03 21:25:19 +0100 |
commit | f095481f0014ab50fc4c8593d6751ab3584b2457 (patch) | |
tree | a869320f271db2cf073dab304f923f1695ecf2fa /http.go | |
parent | fix form empty field error when used with pipe (#1417) (diff) | |
download | fasthttp-f095481f0014ab50fc4c8593d6751ab3584b2457.tar.gz fasthttp-f095481f0014ab50fc4c8593d6751ab3584b2457.tar.bz2 fasthttp-f095481f0014ab50fc4c8593d6751ab3584b2457.zip |
Request.SetTimeout (#1415)
* Request.SetTimeout
This functionally works the same as e.g. Client.DoTimeout(), but we can
also use it for Client.DoRedirect(). There is no way as far as I can
tell to set a timeout on a DoRedirect call, so this makes it possible.
* tests
* docs
Diffstat (limited to 'http.go')
-rw-r--r-- | http.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -2290,3 +2290,11 @@ func round2(n int) int { return int(x + 1) } + +// SetTimeout sets timeout for the request. +// +// req.SetTimeout(t); c.Do(&req, &resp) is equivalent to +// c.DoTimeout(&req, &resp, t) +func (req *Request) SetTimeout(t time.Duration) { + req.timeout = t +} |