Skip to content

Commit

Permalink
Specify HTTP for REDIRECT
Browse files Browse the repository at this point in the history
  • Loading branch information
satnam6502 committed Mar 5, 2015
1 parent 4cd59e6 commit 123ca7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkg/apiserver/redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package apiserver

import (
"fmt"
"net/http"
"time"

Expand Down Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions pkg/apiserver/redirect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 123ca7d

Please sign in to comment.