Add some http-headers to live-api requests

This commit is contained in:
Blue (Lukas Rieger) 2020-08-26 14:38:20 +02:00
parent 576313bd35
commit 8585c9637f

View File

@ -34,6 +34,7 @@
import de.bluecolored.bluemap.common.plugin.PluginConfig;
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.webserver.HttpRequest;
import de.bluecolored.bluemap.core.webserver.HttpRequestHandler;
import de.bluecolored.bluemap.core.webserver.HttpResponse;
@ -70,7 +71,14 @@ public HttpResponse handle(HttpRequest request) {
if (path.endsWith("/")) path = path.substring(0, path.length() - 1);
HttpRequestHandler handler = liveAPIRequests.get(path);
if (handler != null) return handler.handle(request);
if (handler != null) {
HttpResponse response = handler.handle(request);
response.addHeader("Server", "BlueMap v" + BlueMap.VERSION);
response.addHeader("Cache-Control", "no-cache");
response.addHeader("Content-Type", "application/json");
return response;
}
return this.notFoundHandler.handle(request);
}