HTTP Request ResponseStatus and StatusCode

When I request “devices” with null token - I get

response.ResponseStatus = ResponseStatus.Completed


response.StatusCode = HttpStatusCode.Unauthorized

I think it should return

response.ResponseStatus = ResponseStatus.Error

because the first thing I check is response.StatusCode and if it’s not Completed - I check response.StatusCode

Can you please reword your post in terms of the standard HTTP status codes? I’m not sure what language your snippets are from, but it’s not understandable out of context.


Bond returns 204 or 200 response codes when it everything is ok…

What does it return for requests with missing or incorrect token? 401?

Sure Chris.

I’m using RestSharp so it could be a bug in the library. I need to debug RestSharp and find out what’s happening there…

What does it return for requests with missing or incorrect token?

Yeah, it returns 401. And that’s a problem in RestSharp library. So this thread can be deleted…

Looks more like unfortunate naming than a bug to me. I assume this ResponseStatus means something more along the lines of “is my response available?” than the typical use of response “status” to describe how the server responded to your request, like it’s used in response.StatusCode.

From RestSharp library:

/// <summary>
/// Status for responses (surprised?)
/// </summary>
public enum ResponseStatus

Looks about right, so ResponseStatus is assigned by the requestor, if it is Completed, the contents of the response (including StatusCode) are from the Bond, otherwise, something went wrong.