Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tonic_build] can't use with_interceptor along with max_decoding_message_size / max_encoding_message_size #2057

Open
mocchira opened this issue Nov 19, 2024 · 0 comments

Comments

@mocchira
Copy link

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

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

XXXServer::new(inner)
        .max_decoding_message_size(8388608)
        .max_encoding_message_size(8388608)
        .into_intercepted_service(intercept)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant