void main() { rs = rq.get("http://httpbin.org/cookies/set?A=abcd&b=cdef"); assert(rs.code == 200); auto json = parseJSON(cast(string)rs.responseBody.data).object["cookies"].object; assert(json["A"].str == "abcd"); assert(json["b"].str == "cdef"); foreach(c; rq.cookie) { final switch(c.attr) { case "A": assert(c.value == "abcd"); break; case "b": assert(c.value == "cdef"); break; } } }
Set Cookie for http requests. v - array of cookie.
You can set and read cookies. In the next example server set cookie and we read it.