Skip to content

Commit

Permalink
SNOW-1640968 Dispose http response in Okta Authenticator (#1010)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-knozderko authored Aug 28, 2024
1 parent adac81a commit 60c2f2b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ public void TestOktaConnectionUntilMaxTimeout()
{
TokenUrl = $"{oktaUrl}/api/v1/sessions?additionalFields=cookieToken",
SSOUrl = $"{oktaUrl}/app/testaccount/sso/saml",
ResponseContent = new StringContent("<form=error}"),
ResponseContent = "<form=error}",
MaxRetryCount = expectedMaxRetryCount,
MaxRetryTimeout = expectedMaxConnectionTimeout
};
Expand Down Expand Up @@ -2191,7 +2191,7 @@ public void TestAsyncOktaConnectionUntilMaxTimeout()
{
TokenUrl = $"{oktaUrl}/api/v1/sessions?additionalFields=cookieToken",
SSOUrl = $"{oktaUrl}/app/testaccount/sso/saml",
ResponseContent = new StringContent("<form=error}"),
ResponseContent = "<form=error}",
MaxRetryCount = expectedMaxRetryCount,
MaxRetryTimeout = expectedMaxConnectionTimeout
};
Expand Down
4 changes: 2 additions & 2 deletions Snowflake.Data.Tests/Mock/MockOkta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class MockOktaRestRequester : IMockRestRequester
{
public string TokenUrl { get; set; }
public string SSOUrl { get; set; }
public StringContent ResponseContent { get; set; }
public string ResponseContent { get; set; }
public int MaxRetryCount { get; set; }
public int MaxRetryTimeout { get; set; }

Expand All @@ -32,7 +32,7 @@ public Task<T> GetAsync<T>(IRestRequest request, CancellationToken cancellationT
public Task<HttpResponseMessage> GetAsync(IRestRequest request, CancellationToken cancellationToken)
{
var response = new HttpResponseMessage(System.Net.HttpStatusCode.OK);
response.Content = ResponseContent;
response.Content = new StringContent(ResponseContent);
response.Content.Headers.Add(OktaAuthenticator.RetryCountHeader, MaxRetryCount.ToString());
response.Content.Headers.Add(OktaAuthenticator.TimeoutElapsedHeader, MaxRetryTimeout.ToString());
return Task.FromResult(response);
Expand Down
Loading

0 comments on commit 60c2f2b

Please sign in to comment.