RestSharp: RestResponseCookie is not interchangeable with System.Net.Cookie

Expected Behavior

Consider this code

var client = new RestClient("https://example.com/api");
var loginRequest = new RestRequest("Login", Method.POST);
var result = client.Execute(loginRequest ); // has a Set-Cookie: SessionID blablabla

//add the session cookie to the client for all further requests
foreach(var cookie in result.Cookies){
        client.CookieContainer.Add(cookie) //<-- Type Error
}

Actual Behavior

Error: cannot convert "RestSharp.RestResponseCookie" to "System.Net.Cookie"

Is there a good reason to have a RestResponseCookie (which looks like copied from System.Net.Cookie, all fields are the same) and use it over the standard class? Otherwise this looks like a minor design flaw

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 29 (4 by maintainers)

Most upvoted comments

damn bot should be sent to /dev/null