Skip to content

Commit

Permalink
[dotnet] set proper status when creating response
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Jul 13, 2022
1 parent c0fa00f commit 4fc1de0
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions dotnet/src/webdriver/Remote/HttpCommandExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down Expand Up @@ -200,12 +199,6 @@ public virtual Response Execute(Command commandToExecute)
}

Response toReturn = this.CreateResponse(responseInfo);

if (toReturn.Status == WebDriverResult.Success && !((int)responseInfo.StatusCode >= 200 && (int)responseInfo.StatusCode <= 299))
{
toReturn.Status = WebDriverResult.UnhandledError;
}

return toReturn;
}

Expand Down Expand Up @@ -305,6 +298,11 @@ private Response CreateResponse(HttpResponseInfo responseInfo)
{
response = Response.FromJson(body);
}
else if (responseInfo.StatusCode.ToString().First() != '2')
{
response.Status = WebDriverResult.UnhandledError;
response.Value = body;
}
else
{
response.Value = body;
Expand Down

0 comments on commit 4fc1de0

Please sign in to comment.