[tonic_build] can't use with_interceptor along with max_decoding_message_size / max_encoding_message_size
- Dominant language
- Rust
- Stars
- 12.5k
- Forks
- 1.3k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 24
Description
## Bug Report
### Version
0.12.3
### Platform
Darwin MacBook-Pro.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6020 arm64
### Crates
tonic_build
### Description
A server implementation generated by tonic_build has a `with_interceptor` func and it takes two arguments `inner: T, interceptor: F,`.
However `max_decoding_message_size` / `max_encoding_message_size` are methods on the server so it's impossible to use with_interceptor along with max_decoding_message_size / max_encoding_message_size.
There is a workaround like the below
```rust
use tonic::codegen::InterceptedService;
...
InterceptedService::new(
XXXServer::new(inner)
.max_decoding_message_size(8388608)
.max_encoding_message_size(8388608),
intercept, // impl Interceptor
)
```
However it might be better to allow developers to write
```rust
XXXServer::new(inner)
.max_decoding_message_size(8388608)
.max_encoding_message_size(8388608)
.into_intercepted_service(intercept)
```
Contributor guide
Assessment
This issue has not been assessed yet.