allow for passing a custom handler to the empty delegate

This commit is contained in:
Lukasz Szaszkiewicz 2021-09-02 14:22:23 +02:00
parent d9896a23bc
commit 207478c1e6

View File

@ -271,14 +271,20 @@ func (s *GenericAPIServer) NextDelegate() DelegationTarget {
}
type emptyDelegate struct {
handler http.Handler
}
func NewEmptyDelegate() DelegationTarget {
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 {
return nil
return s.handler
}
func (s emptyDelegate) PostStartHooks() map[string]postStartHookEntry {
return map[string]postStartHookEntry{}