aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core.Tests/CompressionTest.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/csharp/Grpc.Core.Tests/CompressionTest.cs')
-rw-r--r--src/csharp/Grpc.Core.Tests/CompressionTest.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/csharp/Grpc.Core.Tests/CompressionTest.cs b/src/csharp/Grpc.Core.Tests/CompressionTest.cs
index 378c81851c..16be210508 100644
--- a/src/csharp/Grpc.Core.Tests/CompressionTest.cs
+++ b/src/csharp/Grpc.Core.Tests/CompressionTest.cs
@@ -34,6 +34,7 @@
using System;
using System.Diagnostics;
using System.Linq;
+using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
@@ -118,5 +119,30 @@ namespace Grpc.Core.Tests
await call.ResponseStream.ToListAsync();
}
+
+ [Test]
+ public void CanReadCompressedMessages()
+ {
+ var compressionMetadata = new Metadata
+ {
+ { new Metadata.Entry(Metadata.CompressionRequestAlgorithmMetadataKey, "gzip") }
+ };
+
+ helper.UnaryHandler = new UnaryServerMethod<string, string>(async (req, context) =>
+ {
+ await context.WriteResponseHeadersAsync(compressionMetadata);
+ return req;
+ });
+
+ var stringBuilder = new StringBuilder();
+ for (int i = 0; i < 200000; i++)
+ {
+ stringBuilder.Append('a');
+ }
+ var request = stringBuilder.ToString();
+ var response = Calls.BlockingUnaryCall(helper.CreateUnaryCall(new CallOptions(compressionMetadata)), request);
+
+ Assert.AreEqual(request, response);
+ }
}
}