Feature/acs 4462 mtls e2e test (#1861)

ACS-4462 add empty response handling
This commit is contained in:
Kacper Magdziarz
2023-04-05 08:22:25 +02:00
committed by GitHub
parent 8b4285afbd
commit 959cf8f13f
2 changed files with 14 additions and 10 deletions

View File

@@ -680,17 +680,22 @@ public class RestWrapper extends DSLWrapper<RestWrapper>
}
else
{
if (returnedResponse.getContentType().contains("image/png"))
if (returnedResponse.asString().isEmpty())
{
LOG.info("On {} {}, received the following response \n{}", restRequest.getHttpMethod(), restRequest.getPath(),
returnedResponse.getStatusCode());
}
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") && !returnedResponse.asString().isEmpty())
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") && !returnedResponse.asString().isEmpty())
else if (returnedResponse.getContentType().contains("application/xml"))
{
String response = parseXML(returnedResponse);
LOG.info("On {} {}, received the following response \n{}", restRequest.getHttpMethod(), restRequest.getPath(), response);

View File

@@ -47,7 +47,6 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
/**