]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: fix test TestServeMuxHandlerRedirects
authorShenghou Ma <minux@golang.org>
Tue, 29 Nov 2016 01:31:18 +0000 (20:31 -0500)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 30 Nov 2016 03:36:02 +0000 (03:36 +0000)
The code was intended to test that mux handler should redirect at
most once, but the added loop condition defeated that. Remove the
loop condition and document the intention better.

Fixes #18068.

Change-Id: I2a4ea041eae27168b45a09aa46e740ac03921594
Reviewed-on: https://go-review.googlesource.com/33654
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

src/net/http/serve_test.go

index 01a289fe973673676894d8e3438313597057d931..593b1f3cdd5ef7e05a9a2c7fb9d83c4640671c8f 100644 (file)
@@ -400,9 +400,9 @@ func TestServeMuxHandlerRedirects(t *testing.T) {
        }
 
        for _, tt := range serveMuxTests2 {
-               tries := 1
+               tries := 1 // expect at most 1 redirection if redirOk is true.
                turl := tt.url
-               for tries > 0 {
+               for {
                        u, e := url.Parse(turl)
                        if e != nil {
                                t.Fatal(e)