Skip to content

Commit

Permalink
Merge pull request #355 from snowflakedb/prep-1.2.6
Browse files Browse the repository at this point in the history
Prep 1.2.6
  • Loading branch information
sfc-gh-abhatnagar authored Jul 30, 2021
2 parents 79bd89c + b322cfe commit be167fc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Snowflake.Data/Core/HttpUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,12 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
if (response != null)
{
if (response.IsSuccessStatusCode) {
logger.Debug($"Success Response: {response.ToString()}");
logger.Debug($"Success Response: StatusCode: {(int)response.StatusCode}, ReasonPhrase: '{response.ReasonPhrase}'");
return response;
}
else
{
logger.Debug($"Failed Response: {response.ToString()}");
logger.Debug($"Failed Response: StatusCode: {(int)response.StatusCode}, ReasonPhrase: '{response.ReasonPhrase}'");
bool isRetryable = isRetryableHTTPCode((int)response.StatusCode);
if (!isRetryable)
{
Expand Down
7 changes: 0 additions & 7 deletions Snowflake.Data/Core/RestRequester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ internal interface IRestRequester

internal class RestRequester : IRestRequester
{
private static SFLogger logger = SFLoggerFactory.GetLogger<RestRequester>();

private static readonly RestRequester instance = new RestRequester();

private RestRequester()
Expand All @@ -56,7 +54,6 @@ public async Task<T> PostAsync<T>(IRestRequest request, CancellationToken cancel
using (var response = await SendAsync(HttpMethod.Post, request, cancellationToken).ConfigureAwait(false))
{
var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
logger.Debug($"Post response: {json}");
return JsonConvert.DeserializeObject<T>(json);
}
}
Expand All @@ -72,23 +69,19 @@ public async Task<T> GetAsync<T>(IRestRequest request, CancellationToken cancell
using (HttpResponseMessage response = await GetAsync(request, cancellationToken).ConfigureAwait(false))
{
var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
logger.Debug($"Get response: {json}");
return JsonConvert.DeserializeObject<T>(json);
}
}

public Task<HttpResponseMessage> GetAsync(IRestRequest request, CancellationToken cancellationToken)
{
HttpRequestMessage message = request.ToRequestMessage(HttpMethod.Get);
logger.Debug($"Http method: {message.ToString()}, http request message: {message.ToString()}");
return SendAsync(HttpMethod.Get, request, cancellationToken);
}

public HttpResponseMessage Get(IRestRequest request)
{
HttpRequestMessage message = request.ToRequestMessage(HttpMethod.Get);
logger.Debug($"Http method: {message.ToString()}, http request message: {message.ToString()}");

//Run synchronous in a new thread-pool task.
return Task.Run(async () => await GetAsync(request, CancellationToken.None)).Result;
}
Expand Down
2 changes: 1 addition & 1 deletion Snowflake.Data/Snowflake.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Product>Snowflake Connector for .NET</Product>
<Authors>howryu, tchen</Authors>
<Copyright>Copyright (c) 2012-2019 Snowflake Computing Inc. All rights reserved.</Copyright>
<Version>1.2.5</Version>
<Version>1.2.6</Version>
<DebugType>Full</DebugType>
</PropertyGroup>

Expand Down

0 comments on commit be167fc

Please sign in to comment.