Set the request Host on http test server

Needed for the remote tests to pass on Go 1.6.

See #1470
This commit is contained in:
Bjørn Erik Pedersen 2015-12-18 15:52:17 +01:00
parent 9edc58a03a
commit 89f8fa586c

View file

@ -114,7 +114,10 @@ func TestScpGetLocal(t *testing.T) {
func getTestServer(handler func(w http.ResponseWriter, r *http.Request)) (*httptest.Server, *http.Client) { func getTestServer(handler func(w http.ResponseWriter, r *http.Request)) (*httptest.Server, *http.Client) {
testServer := httptest.NewServer(http.HandlerFunc(handler)) testServer := httptest.NewServer(http.HandlerFunc(handler))
client := &http.Client{ client := &http.Client{
Transport: &http.Transport{Proxy: func(*http.Request) (*url.URL, error) { return url.Parse(testServer.URL) }}, Transport: &http.Transport{Proxy: func(r *http.Request) (*url.URL, error) {
r.Host = "Host: gohugo.io"
return url.Parse(testServer.URL)
}},
} }
return testServer, client return testServer, client
} }