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

Function ClientSupportedCompressors

server.go:2177–2184  ·  view source on GitHub ↗

ClientSupportedCompressors returns compressor names advertised by the client via grpc-accept-encoding header. The context provided must be the context passed to the server's handler. # Experimental Notice: This function is EXPERIMENTAL and may be changed or removed in a later release.

(ctx context.Context)

Source from the content-addressed store, hash-verified

2175// Notice: This function is EXPERIMENTAL and may be changed or removed in a
2176// later release.
2177func ClientSupportedCompressors(ctx context.Context) ([]string, error) {
2178 stream, ok := ServerTransportStreamFromContext(ctx).(*transport.ServerStream)
2179 if !ok || stream == nil {
2180 return nil, fmt.Errorf("failed to fetch the stream from the given context %v", ctx)
2181 }
2182
2183 return stream.ClientAdvertisedCompressors(), nil
2184}
2185
2186// SetTrailer sets the trailer metadata that will be sent when an RPC returns.
2187// When called more than once, all the provided metadata will be merged.

Callers 1

Calls 3

ErrorfMethod · 0.65

Tested by 1