I am running RestAssured tests and I wanted to read info about the request from the logs ( to use in reports). I have a superclass with the following code which the test classes extent. The superclass:
import java.io.PrintStream;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import io.restassured.filter.log.RequestLoggingFilter;
static StringWriter requestWriter;
static PrintStream requestCapture;
requestWriter = new StringWriter();
requestCapture = new PrintStream(new WriterOutputStream(requestWriter,
StandardCharsets.UTF_8));
filters(new RequestLoggingFilter(requestCapture)
system.out.println(requestWriter.toString())
Gives something like this:
Request method: GET
Request URI: https://xxxxxxxxxxxxx/rest/v1/filters/4b54309a-37f0-11ec-8104-0af82ae7751a/tasks
Proxy: <none>
Request params: <none>
Query params: <none>
Form params: <none>
Path params: <none>
Headers: Accept=*/*
Content-Type=application/json
Cookies: SESSION=869fd661-b0c8-408f-be33-db8951804ef3;Path=/cc;Secure;HttpOnly;SameSite=None
Multiparts: <none>
Body: <none>
Request method: GET
Request URI: https://xxxxxxxxxx/rest/v1/tasks/cee718c1-8822-11ec-89f9-e27daa79f45a
Proxy: <none>
Request params: <
where the logs are always missing the last lines, no matter how big or small it is.