github.com/blend/go-sdk@v1.20220411.3/grpcutil/meta_value.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package grpcutil
     9  
    10  import "google.golang.org/grpc/metadata"
    11  
    12  // MetaValue returns a value from a metadata set.
    13  func MetaValue(md metadata.MD, key string) string {
    14  	if values, ok := md[key]; ok {
    15  		if len(values) > 0 {
    16  			return values[0]
    17  		}
    18  	}
    19  	return ""
    20  }