RestSharp: Cookies are not set during redirect

I am testing RestSharp with opera cookies test suite . It seems RestSharp do not handle set-cookie during redirection, and hence all subsequent tests fail.

let client = new RestClient()
client.CookieContainer <- new System.Net.CookieContainer ()
let req = new RestRequest("http://testsuites.opera.com/cookies/001.php", Method.GET)
let res = client.Execute(req) 
if res.ErrorException <> null then
  printfn "%A" res.ErrorException
else 
  printfn "%s" res.Content

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 1
  • Comments: 15 (6 by maintainers)

Most upvoted comments

RestSharp doesn’t handle redirects currently, it’s done by HttpClient. The issue to handle redirects inside RestSharp instead is open, and some work has been done there, but it’s not complete.

It is a different issue, did you guys look at the date? This issue is from 2019.

yes,When the server returns http code 302 and give a new cookie, RestSharp can redirect to the new location,but the cookie is old one. This issue is still occured on v110.2.0

how about the issue ? this problem occured on v110.2.0