mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
APPS-1593 Only load the response content if we need it.
This commit is contained in:
@@ -512,7 +512,12 @@ public abstract class BaseAPI
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpResponse httpResponse = doRequestJson(HttpPost.class, requestUrl, adminUser, adminPassword, requestParams);
|
HttpResponse httpResponse = doRequestJson(HttpPost.class, requestUrl, adminUser, adminPassword, requestParams);
|
||||||
assertEquals("POST request to " + requestUrl + " was not successful. Response: " + responseBodyToJson(httpResponse), expectedStatusCode, httpResponse.getStatusLine().getStatusCode());
|
if (httpResponse.getStatusLine().getStatusCode() != expectedStatusCode)
|
||||||
|
{
|
||||||
|
// It's only possible to stream the response body once, so ensure we only do this if the test has failed.
|
||||||
|
JSONObject responseJson = responseBodyToJson(httpResponse);
|
||||||
|
assertEquals("POST request to " + requestUrl + " was not successful. Response: " + responseJson, expectedStatusCode, httpResponse.getStatusLine().getStatusCode());
|
||||||
|
}
|
||||||
return httpResponse;
|
return httpResponse;
|
||||||
}
|
}
|
||||||
catch (InstantiationException | IllegalAccessException error)
|
catch (InstantiationException | IllegalAccessException error)
|
||||||
|
Reference in New Issue
Block a user