Skip to content

Commit 0f466b6

Browse files
committed
Simplified logic. Removed some tabs.
1 parent df32c69 commit 0f466b6

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

RestSharp.IntegrationTests/StatusCodeTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ void UrlToStatusCodeHandler(HttpListenerContext obj)
2626
obj.Response.StatusCode = int.Parse(obj.Request.Url.Segments.Last());
2727
}
2828

29+
/// <summary>
30+
/// Success of this test is based largely on the behavior of your current DNS.
31+
/// For example, if you're using OpenDNS this will test will fail; ResponseStatus will be Completed.
32+
/// </summary>
2933
[Fact]
3034
public void Handles_Non_Existent_Domain()
3135
{

RestSharp/Http.Async.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,12 @@ private static void GetRawResponseAsync(IAsyncResult result, Action<HttpWebRespo
266266
if(ex.Status == WebExceptionStatus.RequestCanceled)
267267
{
268268
throw ex;
269-
}
269+
}
270270
if (ex.Response is HttpWebResponse)
271271
{
272272
raw = ex.Response as HttpWebResponse;
273-
} else
273+
}
274+
else
274275
{
275276
throw ex;
276277
}
@@ -306,15 +307,12 @@ private void ResponseCallback(IAsyncResult result, Action<HttpResponse> callback
306307
response.ResponseStatus = ResponseStatus.Aborted;
307308
ExecuteCallback(response, callback);
308309
return;
309-
} else
310-
{
311-
response.ErrorMessage = ex.Message;
312-
response.ErrorException = ex;
313-
response.ResponseStatus = ResponseStatus.Error;
314-
ExecuteCallback(response, callback);
315-
return;
316310
}
317311

312+
response.ErrorMessage = ex.Message;
313+
response.ErrorException = ex;
314+
response.ResponseStatus = ResponseStatus.Error;
315+
ExecuteCallback(response, callback);
318316
}
319317
catch(Exception ex)
320318
{

0 commit comments

Comments
 (0)