rest-assured/src/main/java/io/restassured/internal/http/HTTPBuilder.java
protected Object parseResponse(HttpResponse resp, Object contentType)
            throws IOException {
        // For HEAD or OPTIONS requests, there should be no response entity.
        if (resp.getEntity() == null) {
            log.debug("Response contains no entity.  Parsed data is null.");
            return null;
        }
        // first, start with the _given_ content-type
        String responseContentType = contentType.toString();
        // if the given content-type is ANY ("*/*") then use the response content-type
        try {
            if (ContentType.ANY.toString().equals(responseContentType))
                responseContentType = HttpResponseContentTypeFinder.findContentType(resp);
        } catch (RuntimeException ex) {
            /* if for whatever reason we can't determine the content-type, but
                * still want to attempt to parse the data, use the BINARY
                * content-type so that the response will be buffered into a
                * ByteArrayInputStream. */
            responseContentType = ContentType.BINARY.toString();
        }

        Object parsedData = null;
        log.debug("Parsing response as: " + responseContentType);
        parsedData = resp.getEntity().getContent();
        if (parsedData == null) log.debug("Parser returned null!");
        else log.debug("Parsed data to instance of: " + parsedData.getClass());
        return parsedData;
    }
protected Object parseResponse(HttpResponse resp, Object contentType)
            throws IOException {
        // For HEAD or OPTIONS requests, there should be no response entity.
        if (resp.getEntity() == null) {
            log.debug("Response contains no entity.  Parsed data is null.");
            return null;
        }
        // first, start with the _given_ content-type
        String responseContentType = contentType.toString();
        // if the given content-type is ANY ("*/*") then use the response content-type
        try {
            if (ContentType.ANY.toString().equals(responseContentType))
                responseContentType = HttpResponseContentTypeFinder.findContentType(resp);
        } catch (RuntimeException ex) {
            /* if for whatever reason we can't determine the content-type, but
                * still want to attempt to parse the data, use the BINARY
                * content-type so that the response will be buffered into a
                * ByteArrayInputStream. */
            responseContentType = ContentType.BINARY.toString();
        }

        Object parsedData = null;
        log.debug("Parsing response as: " + responseContentType);
        parsedData = resp.getEntity().getContent();
        if (parsedData == null) log.debug("Parser returned null!");
        else log.debug("Parsed data to instance of: " + parsedData.getClass());
        return parsedData;
    }
protected Object parseResponse ( HttpResponse resp , Object contentType ) throws IOException { // For HEAD or OPTIONS requests, there should be no response entity. if ( resp . getEntity ( ) == null ) { log . debug ( "Response contains no entity.  Parsed data is null." ) ; return null ; } // first, start with the _given_ content-type String responseContentType = contentType . toString ( ) ; // if the given content-type is ANY ("*/*") then use the response content-type try { if ( ContentType . ANY . toString ( ) . equals ( responseContentType ) ) responseContentType = HttpResponseContentTypeFinder . findContentType ( resp ) ; } catch ( RuntimeException ex ) { /* if for whatever reason we can't determine the content-type, but
                * still want to attempt to parse the data, use the BINARY
                * content-type so that the response will be buffered into a
                * ByteArrayInputStream. */ responseContentType = ContentType . BINARY . toString ( ) ; } Object parsedData = null ; log . debug ( "Parsing response as: " + responseContentType ) ; parsedData = resp . getEntity ( ) . getContent ( ) ; if ( parsedData == null ) log . debug ( "Parser returned null!" ) ; else log . debug ( "Parsed data to instance of: " + parsedData . getClass ( ) ) ; return parsedData ; }
Parse the response data based on the given content-type.
If the given content-type is {@link ContentType#ANY}, the
<code>content-type</code> header from the response will be used to
determine how to parse the response.

@param resp
@param contentType
@return whatever was returned from the parser retrieved for the given
content-type, or <code>null</code> if no parser could be found for this
content-type.  The parser will also return <code>null</code> if the
response does not contain any content (e.g. in response to a HEAD request).
@throws HttpResponseException if there is a error parsing the response
Parse the response data based on the given content - type . If the given content - type is { @link ContentType#ANY } the <code > content - type< / code > header from the response will be used to determine how to parse the response .