Skip to content

Commit cbbef18

Browse files
authored
Merge pull request #1093 from o-shevchenko/maxInboundMetadataSize_global
Fix setting maxInboundMetadataSize from GLOBAL
2 parents fd47ce0 + d125ecc commit cbbef18

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

grpc-client-spring-boot-starter/src/main/java/net/devh/boot/grpc/client/config/GrpcChannelProperties.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,9 @@ public void copyDefaultsFrom(final GrpcChannelProperties config) {
501501
if (this.maxInboundMessageSize == null) {
502502
this.maxInboundMessageSize = config.maxInboundMessageSize;
503503
}
504+
if (this.maxInboundMetadataSize == null) {
505+
this.maxInboundMetadataSize = config.maxInboundMetadataSize;
506+
}
504507
if (this.negotiationType == null) {
505508
this.negotiationType = config.negotiationType;
506509
}

grpc-client-spring-boot-starter/src/test/java/net/devh/boot/grpc/client/config/GrpcChannelPropertiesGlobalTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.springframework.beans.factory.annotation.Autowired;
2727
import org.springframework.boot.test.context.SpringBootTest;
2828
import org.springframework.test.context.junit.jupiter.SpringExtension;
29+
import org.springframework.util.unit.DataSize;
2930

3031
/**
3132
* Tests whether the global property fallback works.
@@ -34,6 +35,8 @@
3435
@SpringBootTest(properties = {
3536
"grpc.client.GLOBAL.keepAliveTime=23m",
3637
"grpc.client.GLOBAL.keepAliveTimeout=31s",
38+
"grpc.client.GLOBAL.maxInboundMessageSize=5MB",
39+
"grpc.client.GLOBAL.maxInboundMetadataSize=3MB",
3740
"grpc.client.test.keepAliveTime=42m"})
3841
class GrpcChannelPropertiesGlobalTest {
3942

@@ -52,4 +55,11 @@ void test() {
5255
assertEquals(Duration.ofSeconds(31), this.grpcChannelsProperties.getChannel("test").getKeepAliveTimeout());
5356
}
5457

58+
@Test
59+
void testCopyDefaults() {
60+
assertEquals(DataSize.ofMegabytes(5),
61+
this.grpcChannelsProperties.getChannel("test").getMaxInboundMessageSize());
62+
assertEquals(DataSize.ofMegabytes(3),
63+
this.grpcChannelsProperties.getChannel("test").getMaxInboundMetadataSize());
64+
}
5565
}

0 commit comments

Comments
 (0)