diff --git a/src/main/java/cc/fascinated/common/EndpointStatus.java b/src/main/java/cc/fascinated/common/EndpointStatus.java index aff138f..1dfae67 100644 --- a/src/main/java/cc/fascinated/common/EndpointStatus.java +++ b/src/main/java/cc/fascinated/common/EndpointStatus.java @@ -2,7 +2,6 @@ package cc.fascinated.common; import lombok.AllArgsConstructor; import lombok.Getter; -import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatusCode; import java.util.List; diff --git a/src/main/java/cc/fascinated/common/WebRequest.java b/src/main/java/cc/fascinated/common/WebRequest.java index 695b5bc..2dc5aaa 100644 --- a/src/main/java/cc/fascinated/common/WebRequest.java +++ b/src/main/java/cc/fascinated/common/WebRequest.java @@ -35,7 +35,6 @@ public class WebRequest { ResponseEntity profile = CLIENT.get() .uri(url) .retrieve() - .onStatus(HttpStatusCode::isError, (request, response) -> {}) // Don't throw exceptions on error .toEntity(clazz); if (profile.getStatusCode().isError()) { @@ -53,11 +52,11 @@ public class WebRequest { * @param url the url * @return the response */ - public static ResponseEntity getAndIgnoreErrors(String url) { + public static ResponseEntity get(String url, Class clazz) { return CLIENT.get() .uri(url) .retrieve() .onStatus(HttpStatusCode::isError, (request, response) -> {}) // Don't throw exceptions on error - .toEntity(String.class); + .toEntity(clazz); } } diff --git a/src/main/java/cc/fascinated/service/MojangService.java b/src/main/java/cc/fascinated/service/MojangService.java index f2bc480..b5b575e 100644 --- a/src/main/java/cc/fascinated/service/MojangService.java +++ b/src/main/java/cc/fascinated/service/MojangService.java @@ -192,7 +192,7 @@ public class MojangService { Map endpoints = new HashMap<>(); for (EndpointStatus endpoint : MOJANG_ENDPOINTS) { boolean online = false; - ResponseEntity response = WebRequest.getAndIgnoreErrors(endpoint.getEndpoint()); + ResponseEntity response = WebRequest.get(endpoint.getEndpoint(), String.class); if (endpoint.getAllowedStatuses().contains(response.getStatusCode())) { online = true; }