Delete cookies from RequestSpecification

Viewed 37
RequestSpecification requestSpecification = given().cookie(myCookie);
requestSpecification.cookies(new Cookies()); 

This didn't work, I want to clear cookies in requestSpecification

1 Answers
RequestSpecification reqSpec = given().cookie("cookieKey", "cookieValue");
((RequestSpecificationImpl) reqSpec).removeCookies();

// following request will be executed without cookies defined above:
given().spec(reqSpec).when().get("https://google.com").then().statusCode(200);
Related