Response response2 = restService.restClient()
.get(spec -> spec
.config(sslConfig)
.redirects().follow(false)
.cookie(
response1.getDetailedCookie("PLATFORM_SESSION").getName(),
response1.getDetailedCookie("PLATFORM_SESSION").getValue()
)
.cookie(
response1.getDetailedCookie("PLATFORM_SESSION_ID").getName(),
response1.getDetailedCookie("PLATFORM_SESSION_ID").getValue()
)
.log().all(),
location)
.toResponse();
public void testWithSsl(RestService restService) {
RestAssuredConfig sslConfig = SslConfiguration.getP12Config();
// ---------- 1 запрос ----------
Response response1 = restService.restClient()
.get(spec -> spec
.config(sslConfig)
.redirects().follow(false)
.log().all(),
AuthConfiguration.AUTH_URL)
.toResponse();
System.out.println("========== RESPONSE 1 ==========");
response1.then().log().all();
String location = response1.getHeader("Location");
Cookies cookies = response1.getDetailedCookies();
// ---------- 2 запрос ----------
Response response2 = restService.restClient()
.get(spec -> spec
.config(sslConfig)
.redirects().follow(false)
.cookies(cookies)
.log().all(),
location)
.toResponse();
System.out.println("========== RESPONSE 2 ==========");
response2.then().log().all();
}