io.hyperfoil.http.cookie.CookieAppender Maven / Gradle / Ivy
package io.hyperfoil.http.cookie;
import io.hyperfoil.http.api.HttpRequestWriter;
import io.hyperfoil.api.session.Session;
import io.hyperfoil.function.SerializableBiConsumer;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
public class CookieAppender implements SerializableBiConsumer {
private static final Logger log = LoggerFactory.getLogger(CookieAppender.class);
@Override
public void accept(Session session, HttpRequestWriter writer) {
CookieStore cookies = session.getResource(CookieStore.COOKIES);
if (cookies == null) {
log.error("No cookie store in the session. Did you add CookieRecorder?");
return;
}
cookies.appendCookies(writer);
}
}