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)
| 2175 | // Notice: This function is EXPERIMENTAL and may be changed or removed in a |
| 2176 | // later release. |
| 2177 | func 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. |