Skip to content

Commit e4a2382

Browse files
committed
Fix unnecessary String wrapping
1 parent c57672a commit e4a2382

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/pw/chew/jsonrestapi/RestServer.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,13 @@ private String buildResponse(String method, String route, Map<String, String> pa
224224
// Build the response by letting PAPI parse the placeholders
225225
String response = PlaceholderAPI.setPlaceholders(player, request);
226226

227+
// If response is empty, set it to an empty string.
228+
if (response.isEmpty()) {
229+
response = "\"\""; // Will save as ""
230+
}
231+
227232
// Wrap the response
228-
String json = "{\"success\": true, \"response\": \"" + response + "\"}";
233+
String json = "{\"success\": true, \"response\": " + response + "}";
229234

230235
if (config.getBoolean("debug")) {
231236
logger.info("Response is " + json);

0 commit comments

Comments
 (0)