From 9fe78c8bc4d0eaac60d2db126d0fad1a268b72b5 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Tue, 3 Feb 2015 14:37:56 -0800 Subject: [PATCH] client: don't use nested actions --- client/client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/client.go b/client/client.go index 424b775c8..79f35ae11 100644 --- a/client/client.go +++ b/client/client.go @@ -299,13 +299,14 @@ type redirectFollowingHTTPClient struct { } func (r *redirectFollowingHTTPClient) Do(ctx context.Context, act httpAction) (*http.Response, []byte, error) { + next := act for i := 0; i < 100; i++ { if i > 0 { if err := r.checkRedirect(i); err != nil { return nil, nil, err } } - resp, body, err := r.client.Do(ctx, act) + resp, body, err := r.client.Do(ctx, next) if err != nil { return nil, nil, err } @@ -318,7 +319,7 @@ func (r *redirectFollowingHTTPClient) Do(ctx context.Context, act httpAction) (* if err != nil { return nil, nil, fmt.Errorf("Location header not valid URL: %s", hdr) } - act = &redirectedHTTPAction{ + next = &redirectedHTTPAction{ action: act, location: *loc, }