Search in sources :

Example 1 with Cookies

use of org.springframework.cloud.contract.spec.internal.Cookies 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();
        }
    }
}
Also used : Response(org.springframework.cloud.contract.spec.internal.Response) Cookie(org.springframework.cloud.contract.spec.internal.Cookie) Cookies(org.springframework.cloud.contract.spec.internal.Cookies) NotToEscapePattern(org.springframework.cloud.contract.spec.internal.NotToEscapePattern)

Aggregations

Cookie (org.springframework.cloud.contract.spec.internal.Cookie)1 Cookies (org.springframework.cloud.contract.spec.internal.Cookies)1 NotToEscapePattern (org.springframework.cloud.contract.spec.internal.NotToEscapePattern)1 Response (org.springframework.cloud.contract.spec.internal.Response)1