Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with no setting ResponseStatus.Aborted if the request was aborted just after starting. #380

Merged
merged 3 commits into from
Sep 7, 2013

Conversation

ixkor
Copy link
Contributor

@ixkor ixkor commented May 22, 2013

If the request was aborted just after starting, then callback gets response with ResponseStatus == ResponseStatus.TimedOut or ResponseStatus == ResponseStatus.Error, but not ResponseStatus == ResponseStatus.Aborted.

private HttpResponse CreateErrorResponse(Exception ex)
{
var response = new HttpResponse();
if (ex is WebException && ((WebException)ex).Status == WebExceptionStatus.RequestCanceled)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This results in two casts. Perhaps:

var webException = ex as WebException;
if (webException != null && webException.Status == WebExceptionStatus.RequestCancelled)...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's better.

@haacked
Copy link
Contributor

haacked commented Sep 4, 2013

I really like consolidating the creation of the response in a method, but I had some concerns about the actual implementation.

haacked added a commit that referenced this pull request Sep 7, 2013
Fix bug with no setting ResponseStatus.Aborted if the request was aborted just after starting.
@haacked haacked merged commit 272e6e9 into restsharp:master Sep 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants