diff options
author | Kevin <92656833+kevinthegreat1@users.noreply.github.com> | 2023-10-28 00:50:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-28 00:50:38 -0400 |
commit | 9edc4849a387aef3ac53d43573cfe53f5e06a5eb (patch) | |
tree | 3b0059dee9f41691e8332aafbf27f276379bebde /src/main/java/de/hysky/skyblocker/utils/Http.java | |
parent | 158782dabf00a009d7a431f20d4cb2227ffc4298 (diff) | |
parent | 1cbf455f1b065db83a9b2f433a68fb99d0647494 (diff) | |
download | Skyblocker-9edc4849a387aef3ac53d43573cfe53f5e06a5eb.tar.gz Skyblocker-9edc4849a387aef3ac53d43573cfe53f5e06a5eb.tar.bz2 Skyblocker-9edc4849a387aef3ac53d43573cfe53f5e06a5eb.zip |
Merge pull request #389 from AzureAaron/museum-cache
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 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"); |