-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(client): Prevent disposing of the HttpMessageHandler in CamundaCoudTokenProvider #222
Conversation
Hey @terjeinnerdal thanks for fixing this. Could we add a separate test which fails before and now succeeds with the change? |
Yes, that sounds like a good idea. I'll see if I can find the time today. |
…oudTokenProvider Includes a test which ensures ObjectDisposedException is not thrown when renewing the access token, which will fail if the fix is reverted/removed.
I've included a test now, but the continuous-integration check fails on the integration tests. It shows the following warning: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix and the additional test 👍 I think we can simplify the test and then we can merge it :)
{ | ||
// given | ||
ExpiresIn = 0; | ||
var firstToken = await TokenProvider.GetAccessTokenForRequestAsync(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var firstToken = await TokenProvider.GetAccessTokenForRequestAsync(); | |
await TokenProvider.GetAccessTokenForRequestAsync(); |
var files = Directory.GetFiles(TokenStoragePath); | ||
var tokenFile = files[0]; | ||
await File.WriteAllTextAsync(tokenFile, "FILE_TOKEN"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var files = Directory.GetFiles(TokenStoragePath); | |
var tokenFile = files[0]; | |
await File.WriteAllTextAsync(tokenFile, "FILE_TOKEN"); |
await File.WriteAllTextAsync(tokenFile, "FILE_TOKEN"); | ||
|
||
// when | ||
Token = "SECOND_TOKEN"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Token = "SECOND_TOKEN"; |
Thank you very much for your contribution @terjeinnerdal I created a separate PR to do the clean up for you and to merge it with the latest changes. #235 |
Creates the HttpClient in CamundaCloudTokenProvider constructor. Added CamundaCloudTokenProvider.SetHttpMessageHandler method to set the HttpMessageHandler for testing which will create a new HttpClient.
closes #218