filter jenkins header

Signed-off-by: soulseen <sunzhu@yunify.com>
This commit is contained in:
soulseen
2019-05-22 11:58:19 +08:00
parent 96e32cc003
commit 8979d3a67d

View File

@@ -23,8 +23,11 @@ import (
log "github.com/golang/glog"
"kubesphere.io/kubesphere/pkg/models/devops"
"net/http"
"strings"
)
const jenkinsHeaderPre = "X-"
func GetPipeline(req *restful.Request, resp *restful.Response) {
projectName := req.PathParameter("projectName")
pipelineName := req.PathParameter("pipelineName")
@@ -111,7 +114,9 @@ func GetBranchStepLog(req *restful.Request, resp *restful.Response) {
return
}
for k, v := range header {
resp.AddHeader(k, v[0])
if strings.HasPrefix(k, jenkinsHeaderPre) {
resp.AddHeader(k, v[0])
}
}
resp.Write(res)
}
@@ -129,7 +134,9 @@ func GetStepLog(req *restful.Request, resp *restful.Response) {
return
}
for k, v := range header {
resp.AddHeader(k, v[0])
if strings.HasPrefix(k, jenkinsHeaderPre) {
resp.AddHeader(k, v[0])
}
}
resp.Write(res)
}