test: add httproute-response-header-control for #863 (#875)

This commit is contained in:
brother-戎
2024-03-26 19:08:23 +08:00
committed by GitHub
parent 4d6aa25b19
commit 97cf58e973
3 changed files with 162 additions and 0 deletions

View File

@@ -291,6 +291,16 @@ func (d *DefaultRoundTripper) CaptureRoundTrip(request Request) (*CapturedReques
Path: redirectURL.Path,
}
}
if len(cReq.Namespace) > 0 {
if _, ok := cRes.Headers["Namespace"]; !ok {
cRes.Headers["Namespace"] = []string{cReq.Namespace}
}
}
if len(cReq.Pod) > 0 {
if _, ok := cRes.Headers["Pod"]; !ok {
cRes.Headers["Pod"] = []string{cReq.Pod}
}
}
return cReq, cRes, nil
}