Skip to content

Commit

Permalink
feat(reflection): Add dummy implementation for extension (#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto authored Dec 22, 2022
1 parent a562a3c commit fdff111
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tonic-reflection/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::proto::server_reflection_request::MessageRequest;
use crate::proto::server_reflection_response::MessageResponse;
pub use crate::proto::server_reflection_server::{ServerReflection, ServerReflectionServer};
use crate::proto::{
FileDescriptorResponse, ListServiceResponse, ServerReflectionRequest, ServerReflectionResponse,
ServiceResponse,
ExtensionNumberResponse, FileDescriptorResponse, ListServiceResponse, ServerReflectionRequest,
ServerReflectionResponse, ServiceResponse,
};
use prost::{DecodeError, Message};
use prost_types::{
Expand Down Expand Up @@ -347,7 +347,11 @@ impl ServerReflection for ReflectionService {
Err(Status::not_found("extensions are not supported"))
}
MessageRequest::AllExtensionNumbersOfType(_) => {
Err(Status::not_found("extensions are not supported"))
// NOTE: Workaround. Some grpc clients (e.g. grpcurl) expect this method not to fail.
// https:/hyperium/tonic/issues/1077
Ok(MessageResponse::AllExtensionNumbersResponse(
ExtensionNumberResponse::default(),
))
}
MessageRequest::ListServices(_) => Ok(state.list_services()),
},
Expand Down

0 comments on commit fdff111

Please sign in to comment.