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
16 changes: 11 additions & 5 deletions src/main/java/com/xebialabs/overthere/winrm/WinRmClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,22 @@ private Document doSendRequest(final Document requestDocument, final SoapAction

logResponseHeaders(response);

Document responseDocument = null;
try {
final String responseBody = handleResponse(response, context);
responseDocument = DocumentHelper.parseText(responseBody);
logDocument("Response body:", responseDocument);
} catch(WinRmRuntimeIOException e) {
if (response.getStatusLine().getStatusCode() == 200) {
throw e;
}
}

if (response.getStatusLine().getStatusCode() != 200) {
throw new WinRmRuntimeIOException(String.format("Unexpected HTTP response on %s: %s (%s)",
targetURL, response.getStatusLine().getReasonPhrase(), response.getStatusLine().getStatusCode()));
}

final String responseBody = handleResponse(response, context);
Document responseDocument = DocumentHelper.parseText(responseBody);

logDocument("Response body:", responseDocument);

return responseDocument;
} finally {
connectionManager.shutdown();
Expand Down