Commit e800c391 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #30050 from ping035627/ping035627-patch-0804

Automatic merge from submit-queue Correct the url in comment and optimise the code style The PR modified two aspects: 1) Correct the url in comment, the original url can't be accessed; 2) Optimise the code style according to the go style guide.
parents aa260f50 d902fd6c
......@@ -466,8 +466,8 @@ func (s *GenericAPIServer) init(c *Config) {
handler := http.Handler(s.mux.(*http.ServeMux))
// TODO: handle CORS and auth using go-restful
// See github.com/emicklei/go-restful/blob/GenericAPIServer/examples/restful-CORS-filter.go, and
// github.com/emicklei/go-restful/blob/GenericAPIServer/examples/restful-basic-authentication.go
// See github.com/emicklei/go-restful/blob/master/examples/restful-CORS-filter.go, and
// github.com/emicklei/go-restful/blob/master/examples/restful-basic-authentication.go
if len(c.CorsAllowedOriginList) > 0 {
allowedOriginRegexps, err := util.CompileRegexps(c.CorsAllowedOriginList)
......@@ -507,17 +507,18 @@ func (s *GenericAPIServer) init(c *Config) {
s.Handler = handler
// After all wrapping is done, put a context filter around both handlers
if handler, err := api.NewRequestContextFilter(s.RequestContextMapper, s.Handler); err != nil {
var err error
handler, err = api.NewRequestContextFilter(s.RequestContextMapper, s.Handler)
if err != nil {
glog.Fatalf("Could not initialize request context filter for s.Handler: %v", err)
} else {
s.Handler = handler
}
s.Handler = handler
if handler, err := api.NewRequestContextFilter(s.RequestContextMapper, s.InsecureHandler); err != nil {
handler, err = api.NewRequestContextFilter(s.RequestContextMapper, s.InsecureHandler)
if err != nil {
glog.Fatalf("Could not initialize request context filter for s.InsecureHandler: %v", err)
} else {
s.InsecureHandler = handler
}
s.InsecureHandler = handler
s.installGroupsDiscoveryHandler()
}
......
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