@Override public ResponseDefinition apply(LoggedResponse response) { final ResponseDefinitionBuilder responseDefinitionBuilder = new ResponseDefinitionBuilder() .withStatus(response.getStatus()); if (response.getBody() != null && response.getBody().length > 0) { byte[] body = bodyDecompressedIfRequired(response); String mimeType = response.getMimeType(); Charset charset = response.getCharset(); if (determineIsTextFromMimeType(mimeType)) { responseDefinitionBuilder.withBody(Strings.stringFromBytes(body, charset)); } else { responseDefinitionBuilder.withBody(body); } } if (response.getHeaders() != null) { responseDefinitionBuilder.withHeaders(withoutContentEncodingAndContentLength(response)); } return responseDefinitionBuilder.build(); }