接口cookie配置

////需要引入的包
import org.apache.http.client.CookieStore;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.cookie.BasicClientCookie;

/////// httpclient 实现cookie写入
//// 创建一个本地的cookie store实例
CookieStore cookieStore = new BasicCookieStore();

// 需要填充cookie
BasicClientCookie basicClientCookie = new BasicClientCookie(“BDUSS”,
“xxx”); //存放bduss
basicClientCookie.setVersion(0);
basicClientCookie.setDomain(“xxx”); //可访问此cookie的域名
basicClientCookie.setPath("/");
cookieStore.addCookie(basicClientCookie);

你可能感兴趣的:(接口自动化)