MCPcopy Create free account
hub / github.com/apache/dubbo-go / GetAttachmentAsContext

Method GetAttachmentAsContext

protocol/invocation/rpcinvocation.go:246–262  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

244}
245
246func (r *RPCInvocation) GetAttachmentAsContext() context.Context {
247 ctx := context.Background()
248 var header = http.Header{}
249 for k, v := range r.Attachments() {
250 if str, ok := v.(string); ok {
251 header.Set(k, str)
252 continue
253 }
254 if str, ok := v.([]string); ok {
255 for _, s := range str {
256 header.Add(k, s)
257 }
258 continue
259 }
260 }
261 return triple_protocol.NewOutgoingContext(ctx, header)
262}
263
264func (r *RPCInvocation) MergeAttachmentFromContext(ctx context.Context) {
265 header := triple_protocol.ExtractFromOutgoingContext(ctx)

Callers

nothing calls this directly

Calls 4

AttachmentsMethod · 0.95
NewOutgoingContextFunction · 0.92
SetMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected