diff options
-rw-r--r-- | test/acceptance/serving_test.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/acceptance/serving_test.go b/test/acceptance/serving_test.go index 99afd25f..6afa9560 100644 --- a/test/acceptance/serving_test.go +++ b/test/acceptance/serving_test.go @@ -4,6 +4,7 @@ import ( "fmt" "io/ioutil" "net/http" + "net/textproto" "os" "path" "strings" @@ -678,9 +679,7 @@ func TestServerRepliesWithHeaders(t *testing.T) { require.Equal(t, http.StatusOK, rsp.StatusCode) for key, value := range test.expectedHeaders { - fmt.Printf("expected key: %q - value: %+v\n", key, value) - got := rsp.Header.Values(key) - fmt.Printf("got key: %q - value: %+v\n", key, got) + got := headerValues(rsp.Header, key) require.Equal(t, value, got) } } @@ -712,3 +711,11 @@ func TestServerRepliesWithHeaders(t *testing.T) { }) } } + +func headerValues(header http.Header, key string) []string { + h := textproto.MIMEHeader(header) + + // NOTE: cannot use header.Values() in Go 1.13 or lower, this is the implementation + // from Go 1.15 https://github.com/golang/go/blob/release-branch.go1.15/src/net/textproto/header.go#L46 + return h[textproto.CanonicalMIMEHeaderKey(key)] +} |