MCPcopy
hub / github.com/grpc/grpc-go / GetRequestMetadata

Method GetRequestMetadata

credentials/google/google.go:164–174  ·  view source on GitHub ↗
(ctx context.Context, uri ...string)

Source from the content-addressed store, hash-verified

162}
163
164func (d *dualPerRPCCreds) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
165 ri, ok := credentials.RequestInfoFromContext(ctx)
166 if !ok {
167 return nil, fmt.Errorf("request info not found from context")
168 }
169 if authType := ri.AuthInfo.AuthType(); authType == "alts" {
170 return d.altsPerRPCCreds.GetRequestMetadata(ctx, uri...)
171 }
172 // This ensures backward compatibility even if authType is not "tls".
173 return d.perRPCCreds.GetRequestMetadata(ctx, uri...)
174}
175
176func (d *dualPerRPCCreds) RequireTransportSecurity() bool {
177 return d.altsPerRPCCreds.RequireTransportSecurity() || d.perRPCCreds.RequireTransportSecurity()

Callers

nothing calls this directly

Calls 4

RequestInfoFromContextFunction · 0.92
ErrorfMethod · 0.65
AuthTypeMethod · 0.65
GetRequestMetadataMethod · 0.65

Tested by

no test coverage detected