aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net/http/client_test.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/net/http/client_test.go b/src/net/http/client_test.go
index 8c3fe1b5a2..3d0f1aa6eb 100644
--- a/src/net/http/client_test.go
+++ b/src/net/http/client_test.go
@@ -484,7 +484,11 @@ func testClientRedirectUseResponse(t *testing.T, mode testMode) {
if strings.Contains(r.URL.Path, "/other") {
io.WriteString(w, "wrong body")
} else {
- w.Header().Set("Location", ts.URL+"/other")
+ scheme := "http"
+ if r.TLS != nil {
+ scheme = "https"
+ }
+ w.Header().Set("Location", fmt.Sprintf("%s://%s/other", scheme, r.Host))
w.WriteHeader(StatusFound)
io.WriteString(w, body)
}