Answers for "Force set cookies with retrofit"

0

Force set cookies with retrofit

String url = "https://example.com/webapi";

    OkHttp3CookieHelper cookieHelper = new OkHttp3CookieHelper();
    cookieHelper.setCookie(url, "cookie_name", "cookie_value");

    OkHttpClient client = new OkHttpClient.Builder()
            .cookieJar(cookieHelper.cookieJar())
            .build();

    Request request = new Request.Builder()
            .url(url)
            .build();
Posted by: Guest on August-24-2021

Browse Popular Code Answers by Language