Rework use of context
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"code.google.com/p/go.net/context"
|
||||
|
||||
log "github.com/golang/glog"
|
||||
c "github.com/myodc/go-micro/context"
|
||||
"github.com/myodc/go-micro/server"
|
||||
example "github.com/myodc/go-micro/template/proto/example"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type Example struct{}
|
||||
|
||||
func (e *Example) Call(ctx context.Context, req *example.Request, rsp *example.Response) error {
|
||||
log.Info("Received Example.Call request")
|
||||
md, ok := c.GetMetaData(ctx)
|
||||
if ok {
|
||||
log.Infof("Received Example.Call request with metadata: %v", md)
|
||||
} else {
|
||||
log.Info("Received Example.Call request")
|
||||
}
|
||||
|
||||
rsp.Msg = server.Id + ": Hello " + req.Name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user