I am trying to send a request PUTto update a Saucelabs job through their API . However, the following code hangs, and I'm not sure why.
using (var client = new HttpClient())
{
var sessionId = Browser.Driver.GetSessionId();
var uri = new Uri($"https://saucelabs.com/rest/v1/{Configuration.SauceUserName}/jobs/{sessionId}");
var uriWithCred =
new UriBuilder(uri)
{
UserName = $"{Configuration.SauceUserName}",
Password = $"{Configuration.SauceAccessKey}"
}.Uri;
var payload = new StringContent($"{{\"name\":\"{TestMethodName}\"}}", Encoding.UTF8, "application/json");
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = uriWithCred,
Content = payload
};
var response = client.SendAsync(request).Result;
}
The following cUrl request is successful (of course, with credentials).
curl -X PUT -s -u <username>:<access-key>
-d "{\"name\": \"test name\"}"
https://saucelabs.com/rest/v1/<username>/jobs/<job-id>
Why does this request freeze and what can I do to make it successful?
For reasons unrelated to the question, I cannot set the job name when configuring WebDriver features.
source
share