tonic
tonic copied to clipboard
Add `accept_compressed` and `send_compressed` methods to the `InterceptedService` struct
Feature Request
Motivation
I would like to create a service that has an authentication interceptor that accepts and sends compressed messages.
Since with_interceptor returns an InterceptedService, which doesn't implement accept_compressed and send_compressed, and with_interceptor takes in a service, not a server, I can't do both simultaneously.
This is what I want to do.
let users = UsersServer::with_interceptor(users, authenticator)
.accept_compressed(CompressionEncoding::Gzip)
.send_compressed(CompressionEncoding::Gzip);
There are also max_decoding_message_size, and max_encoding_message_size functions that should be equally accessible for an InterceptedService.
Proposal
Implement the accept_compressed and send_compressed functions for the InterceptedService struct.
@njfewr
I did find a way to do it:
let service = YourService::new();
let service = YourServer::new(service)
.accept_compressed(CompressionEncoding::Gzip)
.send_compressed(CompressionEncoding::Gzip);
let service =
InterceptedService::new(service, interceptor);
I think I'm okay with just closing the issue.