mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
allow for passing a custom handler to the empty delegate
This commit is contained in:
parent
d9896a23bc
commit
207478c1e6
@ -271,14 +271,20 @@ func (s *GenericAPIServer) NextDelegate() DelegationTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type emptyDelegate struct {
|
type emptyDelegate struct {
|
||||||
|
handler http.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyDelegate() DelegationTarget {
|
func NewEmptyDelegate() DelegationTarget {
|
||||||
return emptyDelegate{}
|
return emptyDelegate{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewEmptyDelegateWithCustomHandler allows for registering a custom handler usually for special handling of 404 requests
|
||||||
|
func NewEmptyDelegateWithCustomHandler(handler http.Handler) DelegationTarget {
|
||||||
|
return emptyDelegate{handler}
|
||||||
|
}
|
||||||
|
|
||||||
func (s emptyDelegate) UnprotectedHandler() http.Handler {
|
func (s emptyDelegate) UnprotectedHandler() http.Handler {
|
||||||
return nil
|
return s.handler
|
||||||
}
|
}
|
||||||
func (s emptyDelegate) PostStartHooks() map[string]postStartHookEntry {
|
func (s emptyDelegate) PostStartHooks() map[string]postStartHookEntry {
|
||||||
return map[string]postStartHookEntry{}
|
return map[string]postStartHookEntry{}
|
||||||
|
Loading…
Reference in New Issue
Block a user