Skip to content

Commit

Permalink
fix: logger.warn instead of ISE on transcoding options for non-unary …
Browse files Browse the repository at this point in the history
…gRPC
  • Loading branch information
Dogacel committed Jul 25, 2024
1 parent 104855a commit b6f276f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,12 @@ static GrpcService of(GrpcService delegate, HttpJsonTranscodingOptions httpJsonT

final HttpRule httpRule = methodOptions.getExtension(AnnotationsProto.http);

checkArgument(methodDefinition.getMethodDescriptor().getType() == MethodType.UNARY,
"Only unary methods can be configured with an HTTP/JSON endpoint: " +
"method=%s, httpRule=%s",
methodDefinition.getMethodDescriptor().getFullMethodName(), httpRule);
if (methodDefinition.getMethodDescriptor().getType() != MethodType.UNARY) {
logger.warn("Only unary methods can be configured with an HTTP/JSON endpoint: " +
"method={}, httpRule={}",
methodDefinition.getMethodDescriptor().getFullMethodName(), httpRule);
continue;
}

@Nullable
final Entry<Route, List<PathVariable>> routeAndVariables = toRouteAndPathVariables(httpRule);
Expand Down
6 changes: 6 additions & 0 deletions grpc/src/test/proto/testing/grpc/transcoding.proto
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ service HttpJsonTranscodingTestService {
post: "/v1/arbitrary_wrapped"
};
}

rpc EchoBidirectionalStream(stream Message) returns (stream Message) {
option (google.api.http) = {
post: "/v1/echo/bidirectional_stream"
};
}
}

message GetMessageRequestV1 {
Expand Down

0 comments on commit b6f276f

Please sign in to comment.