dsmiley commented on code in PR #3710:
URL: https://github.com/apache/solr/pull/3710#discussion_r2528511387


##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/InputStreamResponseParser.java:
##########
@@ -38,14 +43,35 @@ public InputStreamResponseParser(String writerType) {
     this.writerType = writerType;
   }
 
+  /**
+   * When using a {@link InputStreamResponseParser}, the raw output is 
available in the response
+   * under the key {@link #STREAM_KEY}.
+   */
+  public static String consumeResponseToString(NamedList<Object> response) 
throws IOException {
+    assert response != null;
+    String output;
+    // Would be nice to validate the STREAM_KEY value is present
+    try (InputStream responseStream = (InputStream) response.get(STREAM_KEY)) {
+      ByteArrayOutputStream baos = new ByteArrayOutputStream();
+      responseStream.transferTo(baos);
+      output = baos.toString(StandardCharsets.UTF_8);
+    }
+    return output;
+  }
+
   @Override
   public String getWriterType() {
     return writerType;
   }
 
   @Override
-  public NamedList<Object> processResponse(InputStream body, String encoding) {
-    throw new UnsupportedOperationException();
+  public NamedList<Object> processResponse(InputStream body, String encoding) 
throws IOException {

Review Comment:
   if you did a self-review Eric, I imagine you would have drawn attention to 
this change, and then I could have noticed it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to