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

Unified Diff: appengine/cmd/dm/distributor/pubsub.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/handlers.go ('k') | appengine/cmd/dm/distributor/tq_handler.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/cmd/dm/distributor/pubsub.go
diff --git a/appengine/cmd/dm/distributor/pubsub.go b/appengine/cmd/dm/distributor/pubsub.go
index 65df41215b52bf74bfeee8f524483f01ce183ed7..a4cf5b4eea720029142d62e81ad0a920a6f2e4c9 100644
--- a/appengine/cmd/dm/distributor/pubsub.go
+++ b/appengine/cmd/dm/distributor/pubsub.go
@@ -4,37 +4,38 @@
package distributor
import (
"encoding/json"
"fmt"
"net/http"
"strconv"
"time"
- "github.com/julienschmidt/httprouter"
"github.com/luci/luci-go/appengine/tumble"
"github.com/luci/luci-go/common/api/dm/service/v1"
"github.com/luci/luci-go/common/logging"
+ "github.com/luci/luci-go/server/router"
"github.com/luci/luci-go/server/tokens"
"golang.org/x/net/context"
)
const notifyTopicSuffix = "dm-distributor-notify"
-// PubsubReciever is the HTTP handler that processes incoming pubsub events
+// PubsubReceiver is the HTTP handler that processes incoming pubsub events
// delivered to topics prepared with TaskDescription.PrepareTopic, and routes
// them to the appropriate distributor implementation's HandleNotification
// method.
//
// It requires that a Registry be installed in c via WithRegistry.
-func PubsubReciever(c context.Context, rw http.ResponseWriter, r *http.Request, p httprouter.Params) {
+func PubsubReceiver(ctx *router.Context) {
+ c, rw, r := ctx.Context, ctx.Writer, ctx.Request
defer r.Body.Close()
type PubsubMessage struct {
Attributes map[string]string `json:"attributes"`
Data []byte `json:"data"`
MessageID string `json:"message_id"`
}
type PubsubPushMessage struct {
Message PubsubMessage `json:"message"`
Subscription string `json:"subscription"`
« no previous file with comments | « appengine/cmd/dm/distributor/handlers.go ('k') | appengine/cmd/dm/distributor/tq_handler.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698