rest-assured/src/main/java/io/restassured/filter/log/StatusCodeBasedLoggingFilter.java
private Response cloneResponseIfNeeded(Response response, byte[] responseAsString) {
        if (responseAsString != null && response instanceof RestAssuredResponseImpl && !((RestAssuredResponseImpl) response).getHasExpectations()) {
            final Response build = new ResponseBuilder().clone(response).setBody(responseAsString).build();
            ((RestAssuredResponseImpl) build).setHasExpectations(true);
            return build;
        }
        return response;
    }
private Response cloneResponseIfNeeded(Response response, byte[] responseAsString) {
        if (responseAsString != null && response instanceof RestAssuredResponseImpl && !((RestAssuredResponseImpl) response).getHasExpectations()) {
            final Response build = new ResponseBuilder().clone(response).setBody(responseAsString).build();
            ((RestAssuredResponseImpl) build).setHasExpectations(true);
            return build;
        }
        return response;
    }
private Response cloneResponseIfNeeded ( Response response , byte [ ] responseAsString ) { if ( responseAsString != null && response instanceof RestAssuredResponseImpl && ! ( ( RestAssuredResponseImpl ) response ) . getHasExpectations ( ) ) { final Response build = new ResponseBuilder ( ) . clone ( response ) . setBody ( responseAsString ) . build ( ) ; ( ( RestAssuredResponseImpl ) build ) . setHasExpectations ( true ) ; return build ; } return response ; }
/*
If body expectations are defined we need to return a new Response otherwise the stream
has been closed due to the logging.
/ * If body expectations are defined we need to return a new Response otherwise the stream has been closed due to the logging .