Damian
unread,Nov 4, 2011, 12:38:28 AM11/4/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to RestSharp
Hi,
i found that RestResponse.Request is not populated, so the
RestRequest.UserState cannot be used.
I have added it in RestClientAsync.cs, to ProcessResponse() and
ConvertToRestResponse() methods
private void ProcessResponse(HttpResponse httpResponse, IRestRequest
request, RestRequestAsyncHandle asyncHandle, Action<RestResponse,
RestRequestAsyncHandle> callback)
{
var restResponse = ConvertToRestResponse(request, httpResponse);
callback(restResponse, asyncHandle);
}
I had to also add it copy operator in RestResponse.cs so it will be
returned in the generic RestResponse<>
public static explicit operator RestResponse<T>(RestResponse
response)
{
return new RestResponse<T>
{
ContentEncoding = response.ContentEncoding,
ContentLength = response.ContentLength,
ContentType = response.ContentType,
Cookies = response.Cookies,
ErrorMessage = response.ErrorMessage,
Headers = response.Headers,
RawBytes = response.RawBytes,
ResponseStatus = response.ResponseStatus,
ResponseUri = response.ResponseUri,
Server = response.Server,
StatusCode = response.StatusCode,
StatusDescription = response.StatusDescription,
Request = response.Request
};
}
regards,
Damian