aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/utils/Http.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/utils/Http.java')
-rw-r--r--src/main/java/de/hysky/skyblocker/utils/Http.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/de/hysky/skyblocker/utils/Http.java b/src/main/java/de/hysky/skyblocker/utils/Http.java
index c961b56f..eabb02e4 100644
--- a/src/main/java/de/hysky/skyblocker/utils/Http.java
+++ b/src/main/java/de/hysky/skyblocker/utils/Http.java
@@ -51,7 +51,7 @@ public class Http {
InputStream decodedInputStream = getDecodedInputStream(response);
String body = new String(decodedInputStream.readAllBytes());
- return new ApiResponse(body, getCacheStatus(response.headers()));
+ return new ApiResponse(body, response.statusCode(), getCacheStatus(response.headers()));
}
public static HttpHeaders sendHeadRequest(String url) throws IOException, InterruptedException {
@@ -120,7 +120,11 @@ public class Http {
}
//TODO If ever needed, we could just replace cache status with the response headers and go from there
- public record ApiResponse(String content, String cacheStatus) {
+ public record ApiResponse(String content, int statusCode, String cacheStatus) {
+
+ public boolean ok() {
+ return statusCode == 200;
+ }
public boolean cached() {
return cacheStatus.equals("HIT");