Open QAInsights opened 3 years ago
In order to switch to the HttpClientWorkerJob you need to replace:
var worker = new Worker(new SocketWorkerJob(uri));
with
var worker = new Worker(new HttpClientWorkerJob(uri));
In the demo WPF app this is in MainWindow.xaml.cs in the StartButton_Click method. You will find something similar in the console application.
I wanted to inject some cookies into the request - in order to do this you need to modify HttpClientWorkerJob to add the cookie when the HttpClient is instantiated e.g.
var cookieContainer = new CookieContainer();
var cookieHandler = new HttpClientHandler {
CookieContainer = cookieContainer
};
var cookie = new Cookie("cookieName", "cookieValue");
cookie.Domain = "https://somedomain.com";
cookieContainer.Add(cookie);
_httpClient = new HttpClient(cookieHandler);
Hope this helps someone else!
Thanks @simon-flanagan
Could you please explain how do we configure or switch between the workers. Read me is confusing.