Skip to content

Commit 06b3504

Browse files
committed
bugfix in REST API
1 parent f9005cc commit 06b3504

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

coinapi/market-data-api-rest/sdk-handcrafted/csharp-rest/CoinAPI.REST.V1/CoinAPI.REST.V1.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<PackageLicenseFile>LICENSE</PackageLicenseFile>
1717
<Company>COINAPI LTD</Company>
1818
<Copyright>COINAPI LTD or its affiliates</Copyright>
19-
<Version>3.2.4</Version>
19+
<Version>3.2.5</Version>
2020
<UserSecretsId>17704ec2-7050-452e-99b5-0eddf76dea5d</UserSecretsId>
2121
</PropertyGroup>
2222

coinapi/market-data-api-rest/sdk-handcrafted/csharp-rest/CoinAPI.REST.V1/CoinApiRestClient.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,23 @@ public static class HttpClientFactory
1616

1717
public static HttpClient GetClient(string apiKey)
1818
{
19-
if (!clients.TryGetValue(apiKey, out HttpClient client))
19+
lock (clients)
2020
{
21-
var handler = new HttpClientHandler
21+
if (!clients.TryGetValue(apiKey, out HttpClient client))
2222
{
23-
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
24-
};
25-
client = new HttpClient(handler);
26-
client.DefaultRequestHeaders.Add("X-CoinAPI-Key", apiKey);
27-
clients[apiKey] = client;
23+
var handler = new HttpClientHandler
24+
{
25+
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
26+
};
27+
client = new HttpClient(handler);
28+
client.DefaultRequestHeaders.Add("X-CoinAPI-Key", apiKey);
29+
clients[apiKey] = client;
30+
}
31+
return client;
2832
}
29-
return client;
3033
}
3134
}
35+
3236
public class CoinApiRestClient
3337
{
3438
private string apiKey;

0 commit comments

Comments
 (0)