MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / extractAPIOptions

Function extractAPIOptions

internal/descriptor/services.go:214–227  ·  view source on GitHub ↗
(meth *descriptorpb.MethodDescriptorProto)

Source from the content-addressed store, hash-verified

212}
213
214func extractAPIOptions(meth *descriptorpb.MethodDescriptorProto) (*options.HttpRule, error) {
215 if meth.Options == nil {
216 return nil, nil
217 }
218 if !proto.HasExtension(meth.Options, options.E_Http) {
219 return nil, nil
220 }
221 ext := proto.GetExtension(meth.Options, options.E_Http)
222 opts, ok := ext.(*options.HttpRule)
223 if !ok {
224 return nil, fmt.Errorf("extension is %T; want an HttpRule", ext)
225 }
226 return opts, nil
227}
228
229func defaultAPIOptions(svc *Service, md *descriptorpb.MethodDescriptorProto) (*options.HttpRule, error) {
230 // FQSN prefixes the service's full name with a '.', e.g.: '.example.ExampleService'

Callers 1

loadServicesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected