From bdf66114c7ad02b41b83522d7e9073cf0957d836 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 17 Oct 2011 14:51:54 -0400 Subject: [PATCH] http: do not depend on map iteration order R=golang-dev, r CC=golang-dev https://golang.org/cl/5284050 --- src/pkg/http/client_test.go | 6 ++++-- 1 file 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) } } -- 2.50.0