File tree Expand file tree Collapse file tree 2 files changed +51
-1
lines changed
Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ public record struct ClientOptions()
2222 /// <summary>
2323 /// The HTTP client to use for making requests in the SDK.
2424 /// </summary>
25- public HttpClient HttpClient { get ; set ; } = new ( ) ;
25+ public HttpClient HttpClient { get ; set ; } =
26+ new ( new HttpClientHandler ( ) { AutomaticDecompression = DecompressionMethods . Available } ) ;
2627
2728 Lazy < string > _baseUrl = new ( ( ) =>
2829 Environment . GetEnvironmentVariable ( "ORB_BASE_URL" ) ?? EnvironmentUrl . Production
Original file line number Diff line number Diff line change 1+ using System . IO ;
2+ using System . IO . Compression ;
3+ using Net = System . Net ;
4+
5+ namespace Orb . Core ;
6+
7+ static class DecompressionMethods
8+ {
9+ internal static readonly Net ::DecompressionMethods Available ;
10+
11+ static DecompressionMethods ( )
12+ {
13+ try
14+ {
15+ // Minimal valid GZip payload (empty body).
16+ var gzipPayload = new byte [ ]
17+ {
18+ 0x1f ,
19+ 0x8b ,
20+ 0x08 ,
21+ 0x00 ,
22+ 0x00 ,
23+ 0x00 ,
24+ 0x00 ,
25+ 0x00 ,
26+ 0x00 ,
27+ 0x03 ,
28+ 0x03 ,
29+ 0x00 ,
30+ 0x00 ,
31+ 0x00 ,
32+ 0x00 ,
33+ 0x00 ,
34+ 0x00 ,
35+ 0x00 ,
36+ 0x00 ,
37+ 0x00 ,
38+ } ;
39+ using var memoryStream = new MemoryStream ( gzipPayload ) ;
40+ using var gzipStream = new GZipStream ( memoryStream , CompressionMode . Decompress ) ;
41+ gzipStream . CopyTo ( Stream . Null ) ;
42+ Available = Net ::DecompressionMethods . GZip ;
43+ }
44+ catch
45+ {
46+ Available = Net ::DecompressionMethods . None ;
47+ }
48+ }
49+ }
You can’t perform that action at this time.
0 commit comments