Improve logging of raw rest actions on failure

Log the method and the path.
This commit is contained in:
Nik Everett 2016-05-09 10:54:40 -04:00
parent 3f3fa59406
commit b7d02fbd1e
1 changed files with 5 additions and 1 deletions

View File

@ -129,7 +129,11 @@ public class DoSection implements ExecutableSection {
}
private String formatStatusCodeMessage(RestResponse restResponse, String expected) {
return "expected [" + expected + "] status code but api [" + apiCallSection.getApi() + "] returned ["
String api = apiCallSection.getApi();
if ("raw".equals(api)) {
api += "[method=" + apiCallSection.getParams().get("method") + " path=" + apiCallSection.getParams().get("path") + "]";
}
return "expected [" + expected + "] status code but api [" + api + "] returned ["
+ restResponse.getStatusCode() + " " + restResponse.getReasonPhrase() + "] [" + restResponse.getBodyAsString() + "]";
}