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

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: Update tests 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..6c8d3cc053548625908df25a628b7ecf09adfa8e 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"
@@ -65,10 +63,9 @@ type Services interface {
// WithProdServices is a middleware Handler 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() router.Handler {
+ return func(c *router.Context) {
+ c.Context = UseProdServices(c.Context)
}
}

Powered by Google App Engine
This is Rietveld 408576698