Unverified Commit 7f82a231 authored by Kubernetes Prow Robot's avatar Kubernetes Prow Robot Committed by GitHub

Merge pull request #72689 from KevinKingKong/fix_aggregator_bug

Fix aggregator bug
parents 2d6834b5 3a52b978
......@@ -142,6 +142,7 @@ func (r *proxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
newReq := req.WithContext(context.Background())
newReq.Header = utilnet.CloneHeader(req.Header)
newReq.URL = location
newReq.Host = location.Host
if handlingInfo.proxyRoundTripper == nil {
proxyError(w, req, "", http.StatusNotFound)
......
......@@ -42,18 +42,21 @@ type targetHTTPHandler struct {
called bool
headers map[string][]string
path string
host string
}
func (d *targetHTTPHandler) Reset() {
d.path = ""
d.called = false
d.headers = nil
d.host = ""
}
func (d *targetHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
d.path = r.URL.Path
d.called = true
d.headers = r.Header
d.host = r.Host
w.WriteHeader(http.StatusOK)
}
......@@ -313,6 +316,10 @@ func TestProxyHandler(t *testing.T) {
t.Errorf("%s: expected %v, got %v", name, e, a)
return
}
if e, a := targetServer.Listener.Addr().String(), target.host; tc.expectedCalled && !reflect.DeepEqual(e, a) {
t.Errorf("%s: expected %v, got %v", name, e, a)
return
}
}()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment