本文整理汇总了Golang中go/uber/org/yarpc.ReqMeta.Headers方法的典型用法代码示例。如果您正苦于以下问题:Golang ReqMeta.Headers方法的具体用法?Golang ReqMeta.Headers怎么用?Golang ReqMeta.Headers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类go/uber/org/yarpc.ReqMeta
的用法示例。
在下文中一共展示了ReqMeta.Headers方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Handle
func (h *multiHopHandler) Handle(ctx context.Context, reqMeta yarpc.ReqMeta, body interface{}) (interface{}, yarpc.ResMeta, error) {
if h.phoneClient == nil {
panic("call SetClient() and SetTransport() first")
}
assertBaggageMatches(ctx, h.t, h.wantBaggage)
span := opentracing.SpanFromContext(ctx)
for key, value := range h.addBaggage {
span.SetBaggageItem(key, value)
}
ctx = opentracing.ContextWithSpan(ctx, span)
var resp js.RawMessage
phoneResMeta, err := h.phoneClient.Call(
ctx,
yarpc.NewReqMeta().Procedure("phone").Headers(reqMeta.Headers()),
&server.PhoneRequest{
Service: "ctxclient",
Procedure: h.phoneCallTo,
Transport: h.phoneCallTransport,
Body: &js.RawMessage{'{', '}'},
}, &resp)
resMeta := yarpc.NewResMeta().Headers(phoneResMeta.Headers())
return map[string]interface{}{}, resMeta, err
}
示例2: resMetaFromReqMeta
func resMetaFromReqMeta(reqMeta yarpc.ReqMeta) yarpc.ResMeta {
return yarpc.NewResMeta().Headers(reqMeta.Headers())
}
示例3: Echo
func (h helloHandler) Echo(ctx context.Context, reqMeta yarpc.ReqMeta, e *echo.EchoRequest) (*echo.EchoResponse, yarpc.ResMeta, error) {
return &echo.EchoResponse{Message: e.Message, Count: e.Count + 1},
yarpc.NewResMeta().Headers(reqMeta.Headers()),
nil
}
示例4: yarpcEcho
func yarpcEcho(ctx context.Context, reqMeta yarpc.ReqMeta, body []byte) ([]byte, yarpc.ResMeta, error) {
return body, yarpc.NewResMeta().Headers(reqMeta.Headers()), nil
}
示例5: Echo
// Echo endpoint for the Echo service.
func (EchoThrift) Echo(ctx context.Context, reqMeta yarpc.ReqMeta, ping *echo.Ping) (*echo.Pong, yarpc.ResMeta, error) {
return &echo.Pong{Boop: ping.Beep}, yarpc.NewResMeta().Headers(reqMeta.Headers()), nil
}
示例6: EchoJSON
// EchoJSON implements the echo procedure.
func EchoJSON(ctx context.Context, reqMeta yarpc.ReqMeta, body map[string]interface{}) (map[string]interface{}, yarpc.ResMeta, error) {
return body, yarpc.NewResMeta().Headers(reqMeta.Headers()), nil
}