mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 21:31:36 +02:00
Respond to HEAD request in /status, /health_check
This commit is contained in:
@@ -28,12 +28,13 @@ public class HealthCheckHandler extends AbstractHandler {
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response
|
||||
) throws IOException {
|
||||
String method = baseRequest.getMethod();
|
||||
if (
|
||||
"GET".equals(baseRequest.getMethod())
|
||||
("GET".equals(method) || "HEAD".equals(method))
|
||||
&& target != null
|
||||
&& target.matches("^\\/health_check\\/?$")
|
||||
) {
|
||||
Log.info("GET <- /health_check");
|
||||
Log.info(method + " <- /health_check");
|
||||
baseRequest.setHandled(true);
|
||||
response.setContentType("text/plain");
|
||||
if (bridge.healthCheck()) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class StatusHandler extends AbstractHandler {
|
||||
|
||||
@@ -28,12 +29,13 @@ public class StatusHandler extends AbstractHandler {
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response
|
||||
) throws IOException {
|
||||
String method = baseRequest.getMethod();
|
||||
if (
|
||||
"GET".equals(baseRequest.getMethod())
|
||||
("GET".equals(method) || "HEAD".equals(method))
|
||||
&& target != null
|
||||
&& target.matches("^\\/status\\/?$")
|
||||
) {
|
||||
Log.info("GET <- /status");
|
||||
Log.info(method + " <- /status");
|
||||
baseRequest.setHandled(true);
|
||||
response.setContentType("text/plain");
|
||||
response.setStatus(200);
|
||||
|
||||
Reference in New Issue
Block a user