From ea8c6730ed5beeff685fcd20d17423a8546daf6c Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 5 Dec 2017 22:32:25 +0000 Subject: [PATCH] internal: fix test on Go 1.10 Go 1.10 no longer sets implicit Content-Type on empty output. Updates golang/go#20784 Change-Id: I3f13f76b94b58869481218ea2e1805f5f4175fd7 Reviewed-on: https://go-review.googlesource.com/82017 Reviewed-by: Ian Lance Taylor --- internal/token_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/token_test.go b/internal/token_test.go index df5eb26..a52bb81 100644 --- a/internal/token_test.go +++ b/internal/token_test.go @@ -6,6 +6,7 @@ package internal import ( "fmt" + "io" "net/http" "net/http/httptest" "net/url" @@ -32,6 +33,7 @@ func TestRetrieveTokenBustedNoSecret(t *testing.T) { if got, want := r.FormValue("client_secret"), ""; got != want { t.Errorf("client_secret = %q; want empty", got) } + io.WriteString(w, "{}") // something non-empty, required to set a Content-Type in Go 1.10 })) defer ts.Close() @@ -82,7 +84,9 @@ func TestProviderAuthHeaderWorksDomain(t *testing.T) { func TestRetrieveTokenWithContexts(t *testing.T) { const clientID = "client-id" - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + io.WriteString(w, "{}") // something non-empty, required to set a Content-Type in Go 1.10 + })) defer ts.Close() _, err := RetrieveToken(context.Background(), clientID, "", ts.URL, url.Values{})