Hi, it appears that this library ignores the cookies provided by the Set-Cookie header in a 301/302 redirect.
My best guess as to what's causing this: when Dart's HTTP library has followRedirects = true, ONLY the headers from the final destination are returned, meaning the headers from the prior responses are totally lost. ☹️
Possible workaround could be:
- Use
final request = Request(...) for all methods
- Set
request.followRedirects = false
- Do
var response = _handleHttpResponse(...) before return
- Check if
response.statusCode is 301/302. If true: Set response = _httpRequest(HttpMethod.GET, response.headers['location'], ...)
return response
Hi, it appears that this library ignores the cookies provided by the
Set-Cookieheader in a 301/302 redirect.My best guess as to what's causing this: when Dart's HTTP library has☹️
followRedirects = true, ONLY the headers from the final destination are returned, meaning the headers from the prior responses are totally lost.Possible workaround could be:
final request = Request(...)for all methodsrequest.followRedirects = falsevar response = _handleHttpResponse(...)before returnresponse.statusCodeis 301/302. If true: Setresponse = _httpRequest(HttpMethod.GET, response.headers['location'], ...)return response