Skip to content

Commit fdff111

Browse files
authored
feat(reflection): Add dummy implementation for extension (#1209)
1 parent a562a3c commit fdff111

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tonic-reflection/src/server.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::proto::server_reflection_request::MessageRequest;
22
use crate::proto::server_reflection_response::MessageResponse;
33
pub use crate::proto::server_reflection_server::{ServerReflection, ServerReflectionServer};
44
use crate::proto::{
5-
FileDescriptorResponse, ListServiceResponse, ServerReflectionRequest, ServerReflectionResponse,
6-
ServiceResponse,
5+
ExtensionNumberResponse, FileDescriptorResponse, ListServiceResponse, ServerReflectionRequest,
6+
ServerReflectionResponse, ServiceResponse,
77
};
88
use prost::{DecodeError, Message};
99
use prost_types::{
@@ -347,7 +347,11 @@ impl ServerReflection for ReflectionService {
347347
Err(Status::not_found("extensions are not supported"))
348348
}
349349
MessageRequest::AllExtensionNumbersOfType(_) => {
350-
Err(Status::not_found("extensions are not supported"))
350+
// NOTE: Workaround. Some grpc clients (e.g. grpcurl) expect this method not to fail.
351+
// https://github.com/hyperium/tonic/issues/1077
352+
Ok(MessageResponse::AllExtensionNumbersResponse(
353+
ExtensionNumberResponse::default(),
354+
))
351355
}
352356
MessageRequest::ListServices(_) => Ok(state.list_services()),
353357
},

0 commit comments

Comments
 (0)