Set Content-Type header to application/json for JSON endpoints (closes #6)

This commit is contained in:
Allink
2022-05-30 03:55:03 +01:00
parent 41a2475e3d
commit 5a0ae8746c
4 changed files with 8 additions and 0 deletions
@@ -80,6 +80,8 @@ public class PunishmentsEndpoint extends AbstractServlet
return new GsonBuilder().registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeSerializer()).setPrettyPrinting().create().toJson(punishedPlayer.getPunishments().stream().peek(punishment -> punishment.setIp("")).toList());
}
}
response.setHeader("content-type", "application/json");
return new GsonBuilder().registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeSerializer()).setPrettyPrinting().create().toJson(punishedPlayer.getPunishments().stream().toList());
}