use of org.springframework.cloud.contract.spec.internal.Cookie in project spring-cloud-contract by spring-cloud.
the class CookieElementProcessor method processCookies.
default void processCookies(SingleContractMetadata metadata) {
Response response = metadata.getContract().getResponse();
Cookies cookies = response.getCookies();
Iterator<Cookie> iterator = cookies.getEntries().iterator();
while (iterator.hasNext()) {
Cookie cookie = iterator.next();
String text = processCookieElement(cookie.getKey(), cookie.getServerValue() instanceof NotToEscapePattern ? cookie.getServerValue() : MapConverter.getTestSideValues(cookie.getServerValue()));
if (iterator.hasNext()) {
blockBuilder().addLine(text).addEndingIfNotPresent();
} else {
blockBuilder().addIndented(text).addEndingIfNotPresent();
}
}
}
use of org.springframework.cloud.contract.spec.internal.Cookie in project spring-cloud-contract by spring-cloud.
the class JaxRsRequestCookiesWhen method appendCookies.
private void appendCookies(Request request) {
Iterator<Cookie> iterator = request.getCookies().getEntries().stream().filter(cookie -> !cookieOfAbsentType(cookie)).iterator();
while (iterator.hasNext()) {
Cookie cookie = iterator.next();
String value = ".cookie(" + this.bodyParser.quotedShortText(cookie.getKey()) + ", " + this.bodyParser.quotedShortText(MapConverter.getTestSideValuesForNonBody(cookie.getServerValue())) + ")";
if (iterator.hasNext()) {
this.blockBuilder.addLine(value);
} else {
this.blockBuilder.addIndented(value);
}
}
}
Aggregations