mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #5076 from satnam6502/redirect
Fix implementation of REDIRECT
This commit is contained in:
commit
6bd842676d
@ -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