use of com.hp.octane.integrations.dto.connectivity.OctaneResponse in project octane-ci-java-sdk by MicroFocus.
the class OctaneRestClientImpl method createNGAResponse.
private OctaneResponse createNGAResponse(OctaneRequest request, HttpResponse response) throws IOException {
OctaneResponse octaneResponse = dtoFactory.newDTO(OctaneResponse.class).setStatus(response.getStatusLine().getStatusCode());
if (response.getEntity() != null) {
octaneResponse.setBody(CIPluginSDKUtils.inputStreamToUTF8String(response.getEntity().getContent()));
}
if (response.getAllHeaders() != null && response.getAllHeaders().length > 0) {
Map<String, String> mapHeaders = new HashMap<>();
for (Header header : response.getAllHeaders()) {
mapHeaders.put(header.getName(), header.getValue());
}
octaneResponse.setHeaders(mapHeaders);
}
if (request != null && request.getHeaders() != null) {
octaneResponse.setCorrelationId(request.getHeaders().get(RestService.CORRELATION_ID_HEADER));
}
return octaneResponse;
}
Aggregations