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.
pull/6/head
Kubernetes Submit Queue 2016-08-17 00:53:53 -07:00 committed by GitHub
commit e800c391f5
1 changed files with 9 additions and 8 deletions

View File

@ -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()
}