You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 6, 2025. It is now read-only.
Just wondering if you can point me in the right direction on an issue we're seeing, that I'm having trouble getting to the bottom of.
One of our web endpoints requires a bearertoken to be created. We're seeing that after a period of time, the bearertoken expires and so subsequent checks fail (as the watcher already exists with old bearertoken)
So we changed the code to the following using the WithHttpServiceProvider method which I assumed would create a new HttpClient with a new BearerToken for each watch iteration.
This doesn't seem to be working though (it seems like something is still being cached... possibly httpclient pooling maybe) but can't put my finger on it. Any ideas ?
var builder = WebWatcherConfiguration.Create(url);
builder = builder.EnsureThat(resp =>
{
//check result code
});
builder.WithHttpServiceProvider(() =>
{
tokenBearer = _authorizationManager
.Authenticate(Settings.Current.ClientId, Settings.Current.Secret, Settings.Current.TenantId);
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("Authorization", $"bearer {tokenBearer}");
return new HttpService(httpClient);
});
watcher = WebWatcher.Create(config.TestName, builder.Build(), config.Group);
Hey @spetz
Just wondering if you can point me in the right direction on an issue we're seeing, that I'm having trouble getting to the bottom of.
One of our web endpoints requires a bearertoken to be created. We're seeing that after a period of time, the bearertoken expires and so subsequent checks fail (as the watcher already exists with old bearertoken)
So we changed the code to the following using the WithHttpServiceProvider method which I assumed would create a new HttpClient with a new BearerToken for each watch iteration.
This doesn't seem to be working though (it seems like something is still being cached... possibly httpclient pooling maybe) but can't put my finger on it. Any ideas ?