Skip to content

Commit a778f25

Browse files
feat(IpfsClient): request compressed responses from the server.
Let's save bandwidth. See ipfs/kubo#4385
1 parent ca349a1 commit a778f25

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/IpfsClient.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,13 @@ HttpClient Api()
213213
{
214214
if (api == null)
215215
{
216-
api = new HttpClient();
216+
var handler = new HttpClientHandler();
217+
if (handler.SupportsAutomaticDecompression)
218+
{
219+
handler.AutomaticDecompression = DecompressionMethods.GZip
220+
| DecompressionMethods.Deflate;
221+
}
222+
api = new HttpClient(handler);
217223
api.DefaultRequestHeaders.Add("User-Agent", UserAgent);
218224
}
219225
}

0 commit comments

Comments
 (0)