if (responseCode == HttpStatus.OK_200 || responseCode == HttpStatus.CREATED_201) {
final InputStream inputStream = connection.getInputStream();
final String responseContent = StringUtils.inputStreamToString(inputStream);
inputStream.close();
return new StubbyResponse(responseCode, responseContent);
}
return new StubbyResponse(responseCode, connection.getResponseMessage());
} finally {
connection.disconnect();
}
}