Skip to content

Commit 6b02b82

Browse files
committed
Indent JSON payloads
1 parent be26caa commit 6b02b82

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/main/java/org/gaul/httpbin/HttpBinHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ public void handle(String target, Request baseRequest,
258258

259259
private static void respondJSON(HttpServletResponse response,
260260
OutputStream os, JSONObject obj) throws IOException {
261-
final byte[] body = obj.toString().getBytes();
261+
byte[] body = obj.toString(/*indent=*/ 2).getBytes(
262+
StandardCharsets.UTF_8);
262263

263264
response.setContentLength(body.length);
264265
response.setContentType("application/json");

0 commit comments

Comments
 (0)