mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
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:
parent
9edc58a03a
commit
89f8fa586c
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue