forked from Mirrors/oauth2
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 <iant@golang.org>
This commit is contained in:
parent
f95fa95eaa
commit
ea8c6730ed
|
@ -6,6 +6,7 @@ package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -32,6 +33,7 @@ func TestRetrieveTokenBustedNoSecret(t *testing.T) {
|
||||||
if got, want := r.FormValue("client_secret"), ""; got != want {
|
if got, want := r.FormValue("client_secret"), ""; got != want {
|
||||||
t.Errorf("client_secret = %q; want empty", got)
|
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()
|
defer ts.Close()
|
||||||
|
|
||||||
|
@ -82,7 +84,9 @@ func TestProviderAuthHeaderWorksDomain(t *testing.T) {
|
||||||
func TestRetrieveTokenWithContexts(t *testing.T) {
|
func TestRetrieveTokenWithContexts(t *testing.T) {
|
||||||
const clientID = "client-id"
|
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()
|
defer ts.Close()
|
||||||
|
|
||||||
_, err := RetrieveToken(context.Background(), clientID, "", ts.URL, url.Values{})
|
_, err := RetrieveToken(context.Background(), clientID, "", ts.URL, url.Values{})
|
||||||
|
|
Loading…
Reference in New Issue