Android CookieManager setCookie添加了新的cookie而不是覆盖

时间:2015-11-04 09:12:44

标签: android cookies http-headers

我有以下代码:

   String cookieString = "sessionid=;";
    CookieManager c = CookieManager.getInstance();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        c.setCookie("https://my.url.com/someotherstuff", cookieString);
        Log.v("Cookies: ", c.getCookie("https://my.url.com/someotherstuff"));
    }

而不是替换" sessionid" cookie的输出是这样的:

Cookies:: sessionid=; sessionid=someIDNumber; csrftoken=someOtherIDNumber

所以它正在添加一个新的sessionid?

任何人都有解决方案吗?

0 个答案:

没有答案