However, neither RemoveHeaders("Cookie") nor SetHeader("Cookie","") works if there already is a cookie. If a previous response within the same job has returned a cookie, these methods are ignored totally. If there wasn't a previous cookie, I can create a new one.
Sub ClearCookies
Dim r As Reflector
r.Target = hc
r.Target = r.GetField("client")
r.Target = r.RunMethod("getCookieStore")
r.RunMethod("clear")
End Sub
What is hc? That variable is undefined.
If I call this function I get a null pointer exception at line r.Target = r.GetField("client").
Anyway, why doesn't it work with removeHeaders and setHeader? This looks like a bug in the library?
But it still does not work. Cookies that are set by the remote host are not affected. Seems like a bug in the library? It's the same with both http and okhttp.
There is actually a difference between http and okhttp here. In okhttp, if you add a cookie and there already are cookies, your cookie is completely ignored. In http you will end up with two cookie headers being send to the server.