only fetch the head on the endpoint status check
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m44s
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m44s
This commit is contained in:
parent
77bd9a7c7e
commit
55c2c95269
@ -60,4 +60,18 @@ public class WebRequest {
|
|||||||
.onStatus(HttpStatusCode::isError, (request, response) -> {}) // Don't throw exceptions on error
|
.onStatus(HttpStatusCode::isError, (request, response) -> {}) // Don't throw exceptions on error
|
||||||
.toEntity(clazz);
|
.toEntity(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a response from the given URL.
|
||||||
|
*
|
||||||
|
* @param url the url
|
||||||
|
* @return the response
|
||||||
|
*/
|
||||||
|
public static ResponseEntity<?> head(String url, Class<?> clazz) {
|
||||||
|
return CLIENT.head()
|
||||||
|
.uri(url)
|
||||||
|
.retrieve()
|
||||||
|
.onStatus(HttpStatusCode::isError, (request, response) -> {}) // Don't throw exceptions on error
|
||||||
|
.toEntity(clazz);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ public class MojangService {
|
|||||||
for (EndpointStatus endpoint : MOJANG_ENDPOINTS) {
|
for (EndpointStatus endpoint : MOJANG_ENDPOINTS) {
|
||||||
CompletableFuture<Boolean> future = CompletableFuture.supplyAsync(() -> {
|
CompletableFuture<Boolean> future = CompletableFuture.supplyAsync(() -> {
|
||||||
boolean online = false;
|
boolean online = false;
|
||||||
ResponseEntity<?> response = WebRequest.get(endpoint.getEndpoint(), String.class);
|
ResponseEntity<?> response = WebRequest.head(endpoint.getEndpoint(), String.class);
|
||||||
if (endpoint.getAllowedStatuses().contains(response.getStatusCode())) {
|
if (endpoint.getAllowedStatuses().contains(response.getStatusCode())) {
|
||||||
online = true;
|
online = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user