THRIFT-4217 HttpClient should support gzip and deflate
Client: C#
Patch: Jens Geyer
diff --git a/lib/csharp/src/Transport/THttpClient.cs b/lib/csharp/src/Transport/THttpClient.cs
index e68d33d..f678d1e 100644
--- a/lib/csharp/src/Transport/THttpClient.cs
+++ b/lib/csharp/src/Transport/THttpClient.cs
@@ -195,18 +195,22 @@
inputStream.Seek(0, 0);
}
- foreach( var encoding in response.Headers.GetValues("Content-Encoding"))
+ var encodings = response.Headers.GetValues("Content-Encoding");
+ if (encodings != null)
{
- switch(encoding)
+ foreach (var encoding in encodings)
{
- case "gzip":
- DecompressGZipped(ref inputStream);
- break;
- case "deflate":
- DecompressDeflated(ref inputStream);
- break;
- default:
- break;
+ switch (encoding)
+ {
+ case "gzip":
+ DecompressGZipped(ref inputStream);
+ break;
+ case "deflate":
+ DecompressDeflated(ref inputStream);
+ break;
+ default:
+ break;
+ }
}
}
}