From aa171210937ad0d5cb4a0f4069061b6f78686197 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 6 Dec 2015 11:14:02 +0100 Subject: Use ParseDuration --- client.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'client.go') 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 } -- cgit v1.2.3