diff --git a/CosmosSharp/CosmosSharp.csproj b/CosmosSharp/CosmosSharp.csproj
index c0d28ff..b0af6eb 100644
--- a/CosmosSharp/CosmosSharp.csproj
+++ b/CosmosSharp/CosmosSharp.csproj
@@ -11,7 +11,7 @@
Copyright (c) 2021 BTCTrader
BTCTrader.CosmosSharp
BTCTrader.CosmosSharp
- 1.1.2
+ 1.1.3
@@ -19,7 +19,7 @@
-
+
diff --git a/CosmosSharp/HttpHandler.cs b/CosmosSharp/HttpHandler.cs
index 9d3f6c8..9deaa25 100644
--- a/CosmosSharp/HttpHandler.cs
+++ b/CosmosSharp/HttpHandler.cs
@@ -15,7 +15,7 @@ async Task IHttpHandler.GetJsonAsync(string url, D
{
// TODO: RestClient --> HttpClient
var client = new RestClient(url);
- var request = new RestRequest(Method.GET);
+ var request = new RestRequest();
if (headerKeyValues != null && headerKeyValues.Count > 0)
{
foreach (var (key, value) in headerKeyValues)
@@ -38,11 +38,11 @@ async Task IHttpHandler.GetJsonAsync(string url, D
return result;
}
- Task IHttpHandler.PostJsonAsync(string url, Dictionary headerKeyValues, TRequestData requestBody)
+ async Task IHttpHandler.PostJsonAsync(string url, Dictionary headerKeyValues, TRequestData requestBody)
{
// TODO: RestClient --> HttpClient
var client = new RestClient(url);
- var request = new RestRequest(Method.POST);
+ var request = new RestRequest();
var body= JsonConvert.SerializeObject(requestBody);
if (headerKeyValues != null && headerKeyValues.Count > 0)
{
@@ -52,7 +52,7 @@ Task IHttpHandler.PostJsonAsync(stri
}
}
request.AddJsonBody(body);
- var response = client.Execute(request);
+ var response = await client.ExecutePostAsync(request);
if (response.StatusCode != HttpStatusCode.OK)
{
@@ -62,10 +62,10 @@ Task IHttpHandler.PostJsonAsync(stri
if(response.Content == null) throw new Exception($"Response is null. Status code: {response.StatusCode}");
var result = JsonConvert.DeserializeObject(response.Content);
- return Task.FromResult(result);
+ return result;
}
- private Exception GetApiError(Uri BaseUrl, IRestRequest request, IRestResponse response)
+ private Exception GetApiError(Uri BaseUrl, RestRequest request, RestResponse response)
{
//Get the values of the parameters passed to the API
string parameters = string.Join(", ", request.Parameters.Select(x => x.Name.ToString() + "=" + ((x.Value == null) ? "NULL" : x.Value)).ToArray());