[dotnet] set proper status when creating response
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;
@@ -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;
}
@@ -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;
