mirror of https://github.com/grpc/grpc-java.git
api: Allow streaming methods to be safe
This commit is contained in:
parent
ddaf1c8ce9
commit
fa45a71ec9
|
|
@ -234,8 +234,6 @@ public final class MethodDescriptor<ReqT, RespT> {
|
|||
this.idempotent = idempotent;
|
||||
this.safe = safe;
|
||||
this.sampledToLocalTracing = sampledToLocalTracing;
|
||||
Preconditions.checkArgument(!safe || type == MethodType.UNARY,
|
||||
"Only unary methods can be specified safe");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -102,8 +102,9 @@ public class MethodDescriptorTest {
|
|||
.setResponseMarshaller(new StringMarshaller())
|
||||
.build();
|
||||
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
MethodDescriptor<String, String> unused = descriptor.toBuilder().setSafe(true).build();
|
||||
// Verify it does not throw
|
||||
MethodDescriptor<String, String> newDescriptor = descriptor.toBuilder().setSafe(true).build();
|
||||
assertTrue(newDescriptor.isSafe());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue