File tree Expand file tree Collapse file tree
src/main/java/pw/chew/jsonrestapi Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,7 +126,10 @@ public void run() {
126126
127127 String response = PlaceholderAPI .setPlaceholders (Bukkit .getOfflinePlayer (UUID .randomUUID ()), config .getString (key + "response" ));
128128
129- respondOk (printWriter , response );
129+ // Wrap the response
130+ String json = "{\" success\" : true, \" response\" : " + response + "}" ;
131+
132+ respondOk (printWriter , json );
130133 } else {
131134 respondNotFound (printWriter );
132135 }
@@ -168,7 +171,7 @@ private void respondNotFound(PrintWriter writer) {
168171 * @param writer The {@link PrintWriter} to print the response to.
169172 */
170173 private void respondOk (PrintWriter writer , String response ) {
171- writer .printf ("HTTP/1.2 200 OK%n%n" + response );
174+ writer .printf ("HTTP/1.2 200 OK%n" + "Content-Type: application/json; charset=utf-8" + "%n %n" + response );
172175 }
173176 }
174177}
You can’t perform that action at this time.
0 commit comments