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

Unified Diff: appengine/cmd/dm/distributor/tq_handler.go

Issue 2043423004: Make HTTP middleware easier to use (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: gaemiddleware: add middleware func for WithProd 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
« no previous file with comments | « appengine/cmd/dm/distributor/pubsub.go ('k') | appengine/cmd/dm/frontend/init.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/cmd/dm/distributor/tq_handler.go
diff --git a/appengine/cmd/dm/distributor/tq_handler.go b/appengine/cmd/dm/distributor/tq_handler.go
index 218f1eb23dbdb5e4a8cbbfcd787eddbcb2695247..631dcde1ced11211c265b6bafee208d8ba0e84df 100644
--- a/appengine/cmd/dm/distributor/tq_handler.go
+++ b/appengine/cmd/dm/distributor/tq_handler.go
@@ -2,38 +2,38 @@
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package distributor
import (
"net/http"
"net/url"
"strings"
- "github.com/julienschmidt/httprouter"
"github.com/luci/luci-go/appengine/tumble"
"github.com/luci/luci-go/common/logging"
- "golang.org/x/net/context"
+ "github.com/luci/luci-go/server/router"
)
const handlerPattern = "/tq/distributor/:cfgName"
func handlerPath(cfgName string) string {
return strings.Replace(handlerPattern, ":cfgName", url.QueryEscape(cfgName), 1)
}
// TaskQueueHandler is the http handler that routes taskqueue tasks made with
// Config.EnqueueTask to a distributor's HandleTaskQueueTask method.
//
-// This requires that c already have a Registry installed via the WithRegistry
-// method.
-func TaskQueueHandler(c context.Context, rw http.ResponseWriter, r *http.Request, p httprouter.Params) {
+// This requires that ctx.Context already have a Registry installed via the
+// WithRegistry method.
+func TaskQueueHandler(ctx *router.Context) {
+ c, rw, r, p := ctx.Context, ctx.Writer, ctx.Request, ctx.Params
defer r.Body.Close()
cfgName := p.ByName("cfgName")
dist, _, err := GetRegistry(c).MakeDistributor(c, cfgName)
if err != nil {
logging.Fields{"error": err, "cfg": cfgName}.Errorf(c, "Failed to make distributor")
http.Error(rw, "bad distributor", http.StatusBadRequest)
return
}
notifications, err := dist.HandleTaskQueueTask(r)
« no previous file with comments | « appengine/cmd/dm/distributor/pubsub.go ('k') | appengine/cmd/dm/frontend/init.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698