Debug logs for WebAPI

This commit is contained in:
Rsl1122 2017-09-15 16:19:52 +03:00
parent 99b265119f
commit 23dd0f37e7
2 changed files with 15 additions and 2 deletions

View File

@ -4,6 +4,7 @@
*/
package main.java.com.djrapitops.plan.systems.webserver;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.systems.webserver.response.ForbiddenResponse;
import main.java.com.djrapitops.plan.systems.webserver.response.Response;
@ -74,7 +75,14 @@ public class APIResponseHandler {
return PageCache.loadPage(error, () -> new BadRequestResponse(error));
}
return api.onResponse(Plan.getInstance(), variables);
Log.debug(request.toString());
Log.debug(requestBody);
Response response = api.onResponse(Plan.getInstance(), variables);
Log.debug(response.toString());
return response;
}
private String readPOSTRequest(InputStream in) throws IOException {

View File

@ -33,7 +33,7 @@ public abstract class Response {
public String getResponse() {
return header + "\r\n"
+ "Content-Type: text/html;\r\n"
+ "Content-Type: " + type + ";\r\n"
+ "Content-Length: " + content.length() + "\r\n"
+ "\r\n"
+ content;
@ -91,4 +91,9 @@ public abstract class Response {
}
}
}
@Override
public String toString() {
return header + " | " + getResponse();
}
}