Skip to content

Commit ea8c673

Browse files
committed
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 <[email protected]>
1 parent f95fa95 commit ea8c673

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/token_test.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package internal
66

77
import (
88
"fmt"
9+
"io"
910
"net/http"
1011
"net/http/httptest"
1112
"net/url"
@@ -32,6 +33,7 @@ func TestRetrieveTokenBustedNoSecret(t *testing.T) {
3233
if got, want := r.FormValue("client_secret"), ""; got != want {
3334
t.Errorf("client_secret = %q; want empty", got)
3435
}
36+
io.WriteString(w, "{}") // something non-empty, required to set a Content-Type in Go 1.10
3537
}))
3638
defer ts.Close()
3739

@@ -82,7 +84,9 @@ func TestProviderAuthHeaderWorksDomain(t *testing.T) {
8284
func TestRetrieveTokenWithContexts(t *testing.T) {
8385
const clientID = "client-id"
8486

85-
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}))
87+
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
88+
io.WriteString(w, "{}") // something non-empty, required to set a Content-Type in Go 1.10
89+
}))
8690
defer ts.Close()
8791

8892
_, err := RetrieveToken(context.Background(), clientID, "", ts.URL, url.Values{})

0 commit comments

Comments
 (0)