mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Specify HTTP for REDIRECT
This commit is contained in:
parent
4cd59e629a
commit
123ca7de53
@ -17,6 +17,7 @@ limitations under the License.
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@ -85,7 +86,7 @@ func (r *RedirectHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Location", location)
|
||||
w.Header().Set("Location", fmt.Sprintf("http://%s", location))
|
||||
w.WriteHeader(http.StatusTemporaryRedirect)
|
||||
httpCode = http.StatusTemporaryRedirect
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func TestRedirect(t *testing.T) {
|
||||
if err == nil || err.(*url.Error).Err != dontFollow {
|
||||
t.Errorf("Unexpected err %#v", err)
|
||||
}
|
||||
if e, a := item.id, resp.Header.Get("Location"); e != a {
|
||||
if e, a := "http://"+item.id, resp.Header.Get("Location"); e != a {
|
||||
t.Errorf("Expected %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
@ -124,7 +124,7 @@ func TestRedirectWithNamespaces(t *testing.T) {
|
||||
if err == nil || err.(*url.Error).Err != dontFollow {
|
||||
t.Errorf("Unexpected err %#v", err)
|
||||
}
|
||||
if e, a := item.id, resp.Header.Get("Location"); e != a {
|
||||
if e, a := "http://"+item.id, resp.Header.Get("Location"); e != a {
|
||||
t.Errorf("Expected %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user