Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1935)

Unified Diff: appengine/logdog/coordinator/service.go

Issue 2043423004: Make HTTP middleware easier to use (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Rebase origin/master Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/logdog/coordinator/service.go
diff --git a/appengine/logdog/coordinator/service.go b/appengine/logdog/coordinator/service.go
index 0358de953dfc68e968bb55bf29ca166a4308ae42..5d6711c0e1c5e0c71ee17ee8b47a47a91abc3c20 100644
--- a/appengine/logdog/coordinator/service.go
+++ b/appengine/logdog/coordinator/service.go
@@ -5,11 +5,9 @@
package coordinator
import (
- "net/http"
"sync"
"sync/atomic"
- "github.com/julienschmidt/httprouter"
gaeauthClient "github.com/luci/luci-go/appengine/gaeauth/client"
"github.com/luci/luci-go/appengine/logdog/coordinator/config"
luciConfig "github.com/luci/luci-go/common/config"
@@ -20,7 +18,7 @@ import (
"github.com/luci/luci-go/common/proto/logdog/svcconfig"
"github.com/luci/luci-go/server/logdog/storage"
"github.com/luci/luci-go/server/logdog/storage/bigtable"
- "github.com/luci/luci-go/server/middleware"
+ "github.com/luci/luci-go/server/router"
"golang.org/x/net/context"
"google.golang.org/cloud"
gcps "google.golang.org/cloud/pubsub"
@@ -63,13 +61,11 @@ type Services interface {
ArchivalPublisher(context.Context) (ArchivalPublisher, error)
}
-// WithProdServices is a middleware Handler that installs a production Services
+// WithProdServices is a middleware that installs a production Services
// instance into its Context.
-func WithProdServices(h middleware.Handler) middleware.Handler {
- return func(c context.Context, rw http.ResponseWriter, r *http.Request, params httprouter.Params) {
- c = UseProdServices(c)
- h(c, rw, r, params)
- }
+func WithProdServices(c *router.Context, next router.Handler) {
+ c.Context = UseProdServices(c.Context)
+ next(c)
}
// UseProdServices installs production Services instance into the supplied

Powered by Google App Engine
This is Rietveld 408576698