diff options
author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2023-10-27 23:53:11 -0400 |
---|---|---|
committer | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2023-10-27 23:53:11 -0400 |
commit | 2903241fe145137f6c1c925ed508c5673228a8d7 (patch) | |
tree | fd36976443c9cb3116de0746423ee2e2596e28d0 /src/main/java/de/hysky/skyblocker/utils/Http.java | |
parent | 31cfd39b39915bea976f6179ee75edec437c9e2e (diff) | |
download | Skyblocker-2903241fe145137f6c1c925ed508c5673228a8d7.tar.gz Skyblocker-2903241fe145137f6c1c925ed508c5673228a8d7.tar.bz2 Skyblocker-2903241fe145137f6c1c925ed508c5673228a8d7.zip |
Museum Item Cache
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/utils/Http.java')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/utils/Http.java | 8 |
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 94506b05..7e3a7a27 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"); |