MCPcopy
hub / github.com/connectrpc/connect-go / newClientConfig

Function newClientConfig

client.go:325–347  ·  view source on GitHub ↗
(rawURL string, options []ClientOption)

Source from the content-addressed store, hash-verified

323}
324
325func newClientConfig(rawURL string, options []ClientOption) (*clientConfig, *Error) {
326 url, err := parseRequestURL(rawURL)
327 if err != nil {
328 return nil, err
329 }
330 protoPath := extractProtoPath(url.Path)
331 config := clientConfig{
332 URL: url,
333 Protocol: &protocolConnect{},
334 Procedure: protoPath,
335 CompressionPools: make(map[string]*compressionPool),
336 BufferPool: newBufferPool(),
337 }
338 withProtoBinaryCodec().applyToClient(&config)
339 withGzip().applyToClient(&config)
340 for _, opt := range options {
341 opt.applyToClient(&config)
342 }
343 if err := config.validate(); err != nil {
344 return nil, err
345 }
346 return &config, nil
347}
348
349func (c *clientConfig) validate() *Error {
350 if c.Codec == nil || c.Codec.Name() == "" {

Callers 2

NewClientFunction · 0.85

Calls 7

validateMethod · 0.95
parseRequestURLFunction · 0.85
extractProtoPathFunction · 0.85
newBufferPoolFunction · 0.85
withProtoBinaryCodecFunction · 0.85
withGzipFunction · 0.85
applyToClientMethod · 0.65

Tested by 1