aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-10-17 14:51:54 -0400
committerRuss Cox <rsc@golang.org>2011-10-17 14:51:54 -0400
commitbdf66114c7ad02b41b83522d7e9073cf0957d836 (patch)
tree12696692af55335861a6e69d5d6d78f3200f4638
parent9a7dd719448071e8e812deeb4757ebf2abff9cff (diff)
downloadgo-bdf66114c7ad02b41b83522d7e9073cf0957d836.tar.gz
go-bdf66114c7ad02b41b83522d7e9073cf0957d836.zip
http: do not depend on map iteration order
R=golang-dev, r CC=golang-dev https://golang.org/cl/5284050
-rw-r--r--src/pkg/http/client_test.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pkg/http/client_test.go b/src/pkg/http/client_test.go
index f22cce50b8..0ad6cd7c2f 100644
--- a/src/pkg/http/client_test.go
+++ b/src/pkg/http/client_test.go
@@ -132,7 +132,9 @@ func TestPostFormRequestFormat(t *testing.T) {
if tr.req.Close {
t.Error("got Close true, want false")
}
+ // Depending on map iteration, body can be either of these.
expectedBody := "foo=bar&foo=bar2&bar=baz"
+ expectedBody1 := "bar=baz&foo=bar&foo=bar2"
if g, e := tr.req.ContentLength, int64(len(expectedBody)); g != e {
t.Errorf("got ContentLength %d, want %d", g, e)
}
@@ -140,8 +142,8 @@ func TestPostFormRequestFormat(t *testing.T) {
if err != nil {
t.Fatalf("ReadAll on req.Body: %v", err)
}
- if g := string(bodyb); g != expectedBody {
- t.Errorf("got body %q, want %q", g, expectedBody)
+ if g := string(bodyb); g != expectedBody && g != expectedBody1 {
+ t.Errorf("got body %q, want %q or %q", g, expectedBody, expectedBody1)
}
}