chore(http): Let the callers convert these to http.Handler.

pull/18015/head
Brett Buddin 2020-05-08 09:01:59 -04:00
parent b58fb7ebe8
commit 8c0643843f
No known key found for this signature in database
GPG Key ID: C51265E441C4C5AC
4 changed files with 9 additions and 9 deletions

View File

@ -89,13 +89,13 @@ func NewCheckHandler(log *zap.Logger, b *CheckBackend) *CheckHandler {
OrganizationService: b.OrganizationService,
}
h.Handler("POST", prefixChecks, withFeatureProxy(b.AlgoWProxy, h.handlePostCheck))
h.Handler("POST", prefixChecks, withFeatureProxy(b.AlgoWProxy, http.HandlerFunc(h.handlePostCheck)))
h.HandlerFunc("GET", prefixChecks, h.handleGetChecks)
h.HandlerFunc("GET", checksIDPath, h.handleGetCheck)
h.HandlerFunc("GET", checksIDQueryPath, h.handleGetCheckQuery)
h.HandlerFunc("DELETE", checksIDPath, h.handleDeleteCheck)
h.Handler("PUT", checksIDPath, withFeatureProxy(b.AlgoWProxy, h.handlePutCheck))
h.Handler("PATCH", checksIDPath, withFeatureProxy(b.AlgoWProxy, h.handlePatchCheck))
h.Handler("PUT", checksIDPath, withFeatureProxy(b.AlgoWProxy, http.HandlerFunc(h.handlePutCheck)))
h.Handler("PATCH", checksIDPath, withFeatureProxy(b.AlgoWProxy, http.HandlerFunc(h.handlePatchCheck)))
memberBackend := MemberBackend{
HTTPErrorHandler: b.HTTPErrorHandler,

View File

@ -99,13 +99,13 @@ func NewNotificationRuleHandler(log *zap.Logger, b *NotificationRuleBackend) *No
TaskService: b.TaskService,
}
h.Handler("POST", prefixNotificationRules, withFeatureProxy(b.AlgoWProxy, h.handlePostNotificationRule))
h.Handler("POST", prefixNotificationRules, withFeatureProxy(b.AlgoWProxy, http.HandlerFunc(h.handlePostNotificationRule)))
h.HandlerFunc("GET", prefixNotificationRules, h.handleGetNotificationRules)
h.HandlerFunc("GET", notificationRulesIDPath, h.handleGetNotificationRule)
h.HandlerFunc("GET", notificationRulesIDQueryPath, h.handleGetNotificationRuleQuery)
h.HandlerFunc("DELETE", notificationRulesIDPath, h.handleDeleteNotificationRule)
h.Handler("PUT", notificationRulesIDPath, withFeatureProxy(b.AlgoWProxy, h.handlePutNotificationRule))
h.Handler("PATCH", notificationRulesIDPath, withFeatureProxy(b.AlgoWProxy, h.handlePatchNotificationRule))
h.Handler("PUT", notificationRulesIDPath, withFeatureProxy(b.AlgoWProxy, http.HandlerFunc(h.handlePutNotificationRule)))
h.Handler("PATCH", notificationRulesIDPath, withFeatureProxy(b.AlgoWProxy, http.HandlerFunc(h.handlePatchNotificationRule)))
memberBackend := MemberBackend{
HTTPErrorHandler: b.HTTPErrorHandler,

View File

@ -7,7 +7,7 @@ import (
var _ http.Handler = &proxyHandler{}
// withFeatureProxy wraps an HTTP handler in a proxyHandler
func withFeatureProxy(proxy FeatureProxyHandler, h http.HandlerFunc) *proxyHandler {
func withFeatureProxy(proxy FeatureProxyHandler, h http.Handler) *proxyHandler {
if proxy == nil {
proxy = &NoopProxyHandler{}
}

View File

@ -100,10 +100,10 @@ func NewTaskHandler(log *zap.Logger, b *TaskBackend) *TaskHandler {
}
h.HandlerFunc("GET", prefixTasks, h.handleGetTasks)
h.Handler("POST", prefixTasks, withFeatureProxy(b.AlgoWProxy, h.handlePostTask))
h.Handler("POST", prefixTasks, withFeatureProxy(b.AlgoWProxy, http.HandlerFunc(h.handlePostTask)))
h.HandlerFunc("GET", tasksIDPath, h.handleGetTask)
h.Handler("PATCH", tasksIDPath, withFeatureProxy(b.AlgoWProxy, h.handleUpdateTask))
h.Handler("PATCH", tasksIDPath, withFeatureProxy(b.AlgoWProxy, http.HandlerFunc(h.handleUpdateTask)))
h.HandlerFunc("DELETE", tasksIDPath, h.handleDeleteTask)
h.HandlerFunc("GET", tasksIDLogsPath, h.handleGetLogs)