aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-06 11:14:02 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-06 11:14:02 +0100
commitaa171210937ad0d5cb4a0f4069061b6f78686197 (patch)
tree6e0cace543f22531e8bea963c031d8c0ea08b472 /client.go
parent4c01872714a54959d32cce1a651756019d185f32 (diff)
Use ParseDuration
Diffstat (limited to 'client.go')
-rw-r--r--client.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/client.go b/client.go
index a64f0d5..8e92127 100644
--- a/client.go
+++ b/client.go
@@ -7,7 +7,6 @@ import (
"net/http"
"net/textproto"
"regexp"
- "strconv"
"time"
)
@@ -93,10 +92,9 @@ func link(r *http.Response) Links {
}
func retryAfter(r *http.Response) time.Duration {
- if ra := r.Header.Get("Retry-After"); ra != "" {
- if i, err := strconv.Atoi(ra); err == nil {
- return time.Duration(i) * time.Second
- }
+ ra := r.Header.Get("Retry-After")
+ if d, err := time.ParseDuration(ra + "s"); err == nil {
+ return d
}
return time.Second
}