C:/Go/pkg/mod/google.golang.org/grpc@v1.29.1/metadata/metadata.go:180


// FromOutgoingContextRaw returns the un-merged, intermediary contents
// of rawMD. Remember to perform strings.ToLower on the keys. The returned
// MD should not be modified. Writing to it may cause races. Modification
// should be made to copies of the returned MD.
//
// This is intended for gRPC-internal use ONLY.
func FromOutgoingContextRaw(ctx context.Context) (MD, [][]string, bool) {
raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD)
if !ok {
return nil, nil, false
}

return raw.md, raw.added, true
}

// FromOutgoingContext returns the outgoing metadata in ctx if it exists. The
// returned MD should not be modified. Writing to it may cause races.
// Modification should be made to copies of the returned MD.
func FromOutgoingContext(ctx context.Context) (MD, bool) {
raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD)
if !ok {
return nil, false
}

mds := make([]MD, 0, len(raw.added)+1)
mds = append(mds, raw.md)
for _, vv := range raw.added {
mds = append(mds, Pairs(vv...))
}
return Join(mds...), ok
}

 

相关文章:

  • 2021-06-22
  • 2022-12-23
  • 2022-03-08
  • 2022-12-23
  • 2021-04-03
  • 2021-04-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-19
  • 2021-06-26
  • 2021-10-12
  • 2022-02-03
  • 2022-12-23
  • 2022-01-07
相关资源
相似解决方案