code cleanup
authorNiki Roo <niki@nikiroo.be>
Thu, 21 May 2020 20:12:35 +0000 (22:12 +0200)
committerNiki Roo <niki@nikiroo.be>
Thu, 21 May 2020 20:12:35 +0000 (22:12 +0200)
src/be/nikiroo/fanfix/library/WebLibraryServer.java
src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java

index 22f36e91f5729a7bfef72fe9c98d2a7fa157a6ec..56d78ed4de20b5a52583af21105043a07cc8e89f 100644 (file)
@@ -217,9 +217,8 @@ public class WebLibraryServer extends WebLibraryServerHtml {
                                jsons.add(JsonIO.toJson(meta));
                        }
 
-                       return newInputStreamResponse("application/json",
-                                       new ByteArrayInputStream(
-                                                       new JSONArray(jsons).toString().getBytes()));
+                       return NanoHTTPD.newFixedLengthResponse(Status.OK,
+                                       "application/json", new JSONArray(jsons).toString());
                }
 
                return NanoHTTPD.newFixedLengthResponse(Status.BAD_REQUEST,
index 3dbc4aee399a7f10aecbfd6425703d0c350e75fe..63c50c54df64c4ad5ed5810d030a5783e30ad12e 100644 (file)
@@ -759,7 +759,7 @@ abstract class WebLibraryServerHtml implements Runnable {
                                        NanoHTTPD.MIME_PLAINTEXT, "Error when processing request");
                }
        }
-
+       
        protected Response newInputStreamResponse(String mimeType, InputStream in) {
                if (in == null) {
                        return NanoHTTPD.newFixedLengthResponse(Status.NO_CONTENT, "",