NewHandler implements protocol, so it must return an interface.
(params *protocolHandlerParams)
| 78 | |
| 79 | // NewHandler implements protocol, so it must return an interface. |
| 80 | func (g *protocolGRPC) NewHandler(params *protocolHandlerParams) protocolHandler { |
| 81 | bare, prefix := grpcContentTypeDefault, grpcContentTypePrefix |
| 82 | if g.web { |
| 83 | bare, prefix = grpcWebContentTypeDefault, grpcWebContentTypePrefix |
| 84 | } |
| 85 | contentTypes := make(map[string]struct{}) |
| 86 | for _, name := range params.Codecs.Names() { |
| 87 | contentTypes[canonicalizeContentType(prefix+name)] = struct{}{} |
| 88 | } |
| 89 | if params.Codecs.Get(codecNameProto) != nil { |
| 90 | contentTypes[bare] = struct{}{} |
| 91 | } |
| 92 | return &grpcHandler{ |
| 93 | protocolHandlerParams: *params, |
| 94 | web: g.web, |
| 95 | accept: contentTypes, |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | // NewClient implements protocol, so it must return an interface. |
| 100 | func (g *protocolGRPC) NewClient(params *protocolClientParams) (protocolClient, error) { |
nothing calls this directly
no test coverage detected