本文整理汇总了Java中io.restassured.response.Response.getCookies方法的典型用法代码示例。如果您正苦于以下问题:Java Response.getCookies方法的具体用法?Java Response.getCookies怎么用?Java Response.getCookies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.restassured.response.Response
的用法示例。
在下文中一共展示了Response.getCookies方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: login
import io.restassured.response.Response; //导入方法依赖的package包/类
public void login() {
Response response = httpMessageSender.getResponseFrom("/login");
String authenticity_token =
getAuthenticityTokenFromResponse(response);
// post the login form and get the cookies
response = loginUserPost(username, password, authenticity_token);
if(response.getStatusCode()==302) {
//get the cookies
loggedInCookieJar = response.getCookies();
}else{
System.out.println(response.asString());
new RuntimeException("Could not login");
}
}
示例2: createUser
import io.restassured.response.Response; //导入方法依赖的package包/类
public Response createUser(String username, String password){
Response response= httpMessageSender.getResponseFrom(
"/signup",
loggedInCookieJar);
String authenticity_token =
getAuthenticityTokenFromResponse(response);
// cookies seem to change after signup
// - if I don't use these then the request fails
loggedInCookieJar = response.getCookies();
response = createUserPost(username, password,
authenticity_token,
loggedInCookieJar);
if(response.getStatusCode()!=302) {
//get the cookies
loggedInCookieJar = response.getCookies();
}else{
System.out.println(response.asString());
new RuntimeException(
String.format("Could not create user %s %s",
username, password));
}
return response;
}