Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/main/java/api_assured/Caller.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract class Caller {
/**
* A static boolean variable that determines whether logs should be kept for API calls.
*/
protected static boolean keepLogs;
public static boolean keepLogs;

/**
* A Printer object for logging.
Expand Down Expand Up @@ -143,12 +143,14 @@ private static <T> Response<T> getResponse(Call<T> call, boolean printBody) thro
if (keepLogs) log.success("The response code is: " + response.code());
if (keepLogs && !response.message().isEmpty()) log.info(response.message());
if (printBody && printableResponse) log.info("The response body is: \n" + getJsonString(body));
assert body != null;
return Response.success(body, response.raw());
}
else {
log.warning("The response code is: " + response.code());
if (response.message().length()>0) log.warning(response.message());
if (response.errorBody() != null && printBody) {
if (!response.message().isEmpty()) log.warning(response.message());
assert response.errorBody() != null;
if (printBody) {
Object errorBody = getJsonString(getErrorObject(response, Object.class));
String errorLog = errorBody.equals("null") ? "The error body is empty." : "The error body is: \n" + errorBody;
log.warning(errorLog);
Expand Down