diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2015-12-03 18:58:05 +0000 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2015-12-03 19:53:44 +0000 |
| commit | a778ac5d76c47f6cc88846d58263c63ae8eaec86 (patch) | |
| tree | aa56890ecb48f182beadefcad23e1d0d3a48c64c /src/net/http/client_test.go | |
| parent | 723605e9183314e977542fdca208f4ddeb5425f7 (diff) | |
| download | go-a778ac5d76c47f6cc88846d58263c63ae8eaec86.tar.xz | |
net/http: make Client follow redirects even if Request.Method is empty
Fixes #12705
Change-Id: I69639d2b03777835b2697ff349a00ccab410aa49
Reviewed-on: https://go-review.googlesource.com/17318
Reviewed-by: Burcu Dogan <jbd@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/net/http/client_test.go')
| -rw-r--r-- | src/net/http/client_test.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/net/http/client_test.go b/src/net/http/client_test.go index 40d5109862..e59ab2cd0e 100644 --- a/src/net/http/client_test.go +++ b/src/net/http/client_test.go @@ -230,6 +230,13 @@ func TestClientRedirects(t *testing.T) { t.Errorf("with default client Do, expected error %q, got %q", e, g) } + // Requests with an empty Method should also redirect (Issue 12705) + greq.Method = "" + _, err = c.Do(greq) + if e, g := "Get /?n=10: stopped after 10 redirects", fmt.Sprintf("%v", err); e != g { + t.Errorf("with default client Do and empty Method, expected error %q, got %q", e, g) + } + var checkErr error var lastVia []*Request c = &Client{CheckRedirect: func(_ *Request, via []*Request) error { |
