mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Feature/acs 4462 mtls e2e test (#1861)
ACS-4462 add empty response handling
This commit is contained in:
@@ -680,17 +680,22 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (returnedResponse.getContentType().contains("image/png"))
|
if (returnedResponse.asString().isEmpty())
|
||||||
{
|
|
||||||
LOG.info("On {} {}, received the response with an image and headers: \n{}", restRequest.getHttpMethod(), restRequest.getPath(),
|
|
||||||
returnedResponse.getHeaders().toString());
|
|
||||||
}
|
|
||||||
else if (returnedResponse.getContentType().contains("application/json") && !returnedResponse.asString().isEmpty())
|
|
||||||
{
|
{
|
||||||
LOG.info("On {} {}, received the following response \n{}", restRequest.getHttpMethod(), restRequest.getPath(),
|
LOG.info("On {} {}, received the following response \n{}", restRequest.getHttpMethod(), restRequest.getPath(),
|
||||||
Utility.prettyPrintJsonString(returnedResponse.asString()));
|
returnedResponse.getStatusCode());
|
||||||
}
|
}
|
||||||
else if (returnedResponse.getContentType().contains("application/xml") && !returnedResponse.asString().isEmpty())
|
else if (returnedResponse.getContentType().contains("image/png"))
|
||||||
|
{
|
||||||
|
LOG.info("On {} {}, received the response with an image and headers: \n{}", restRequest.getHttpMethod(), restRequest.getPath(),
|
||||||
|
returnedResponse.getHeaders().toString());
|
||||||
|
}
|
||||||
|
else if (returnedResponse.getContentType().contains("application/json"))
|
||||||
|
{
|
||||||
|
LOG.info("On {} {}, received the following response \n{}", restRequest.getHttpMethod(), restRequest.getPath(),
|
||||||
|
Utility.prettyPrintJsonString(returnedResponse.asString()));
|
||||||
|
}
|
||||||
|
else if (returnedResponse.getContentType().contains("application/xml"))
|
||||||
{
|
{
|
||||||
String response = parseXML(returnedResponse);
|
String response = parseXML(returnedResponse);
|
||||||
LOG.info("On {} {}, received the following response \n{}", restRequest.getHttpMethod(), restRequest.getPath(), response);
|
LOG.info("On {} {}, received the following response \n{}", restRequest.getHttpMethod(), restRequest.getPath(), response);
|
||||||
@@ -698,7 +703,7 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG.info("On {} {}, received the following response \n{}", restRequest.getHttpMethod(), restRequest.getPath(),
|
LOG.info("On {} {}, received the following response \n{}", restRequest.getHttpMethod(), restRequest.getPath(),
|
||||||
ToStringBuilder.reflectionToString(returnedResponse.asString(), ToStringStyle.MULTI_LINE_STYLE));
|
ToStringBuilder.reflectionToString(returnedResponse.asString(), ToStringStyle.MULTI_LINE_STYLE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,7 +47,6 @@ import org.apache.http.client.methods.HttpPost;
|
|||||||
import org.apache.http.entity.ContentType;
|
import org.apache.http.entity.ContentType;
|
||||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user