diff --git a/examples/src/reflection/server.rs b/examples/src/reflection/server.rs index 500141fbb..4bcd5d2d9 100644 --- a/examples/src/reflection/server.rs +++ b/examples/src/reflection/server.rs @@ -30,7 +30,7 @@ impl proto::greeter_server::Greeter for MyGreeter { async fn main() -> Result<(), Box> { let service = tonic_reflection::server::Builder::configure() .register_encoded_file_descriptor_set(proto::FILE_DESCRIPTOR_SET) - .build() + .build_v1() .unwrap(); let addr = "[::1]:50052".parse().unwrap(); diff --git a/tonic-reflection/src/server/mod.rs b/tonic-reflection/src/server/mod.rs index c317685e5..9d7ce2d5e 100644 --- a/tonic-reflection/src/server/mod.rs +++ b/tonic-reflection/src/server/mod.rs @@ -73,7 +73,15 @@ impl<'b> Builder<'b> { } /// Build a v1 gRPC Reflection Service to be served via Tonic. - pub fn build(mut self) -> Result, Error> { + #[deprecated(since = "0.12.2", note = "use `build_v1()` instead")] + pub fn build(self) -> Result, Error> { + self.build_v1() + } + + /// Build a v1 gRPC Reflection Service to be served via Tonic. + pub fn build_v1( + mut self, + ) -> Result, Error> { if self.include_reflection_service { self = self.register_encoded_file_descriptor_set(crate::pb::v1::FILE_DESCRIPTOR_SET); } diff --git a/tonic-reflection/tests/server.rs b/tonic-reflection/tests/server.rs index facb75034..48d3a5393 100644 --- a/tonic-reflection/tests/server.rs +++ b/tonic-reflection/tests/server.rs @@ -100,7 +100,7 @@ async fn make_test_reflection_request(request: ServerReflectionRequest) -> Messa let jh = tokio::spawn(async move { let service = Builder::configure() .register_encoded_file_descriptor_set(FILE_DESCRIPTOR_SET) - .build() + .build_v1() .unwrap(); Server::builder() diff --git a/tonic-reflection/tests/versions.rs b/tonic-reflection/tests/versions.rs index ad31b8477..1f044d0ee 100644 --- a/tonic-reflection/tests/versions.rs +++ b/tonic-reflection/tests/versions.rs @@ -65,7 +65,7 @@ async fn make_v1_request( let listener = tokio::net::TcpListener::bind(addr).await.expect("bind"); let local_addr = format!("http://{}", listener.local_addr().expect("local address")); let jh = tokio::spawn(async move { - let service = Builder::configure().build().unwrap(); + let service = Builder::configure().build_v1().unwrap(); Server::builder() .add_service(service)