From b1a63d57b6c667667c2de2d8c62c2a5890e6307c Mon Sep 17 00:00:00 2001 From: Aurora Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Wed, 25 Jan 2023 21:50:03 +0200 Subject: [PATCH] Don't accept redirect in https test --- .../djrapitops/plan/delivery/webserver/HttpsServerTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Plan/common/src/test/java/com/djrapitops/plan/delivery/webserver/HttpsServerTest.java b/Plan/common/src/test/java/com/djrapitops/plan/delivery/webserver/HttpsServerTest.java index db7cef45d..1609bad3f 100644 --- a/Plan/common/src/test/java/com/djrapitops/plan/delivery/webserver/HttpsServerTest.java +++ b/Plan/common/src/test/java/com/djrapitops/plan/delivery/webserver/HttpsServerTest.java @@ -52,7 +52,7 @@ interface HttpsServerTest { String address = "https://localhost:" + testPortNumber(); String cookie = login(address); - testAccess(address, cookie); + testAccess(address + "/server/Server%201", cookie); } default void testAccess(String address, String cookie) throws IOException, KeyManagementException, NoSuchAlgorithmException { @@ -64,7 +64,8 @@ interface HttpsServerTest { int responseCode = connection.getResponseCode(); switch (responseCode) { - case 200, 302 -> {} + case 200 -> {} + case 302 -> throw new IllegalStateException("Redirection to " + connection.getHeaderField("Location")); case 400 -> throw new IllegalStateException("Bad Request: " + address); case 403 -> throw new IllegalStateException(address + " returned 403"); case 404 -> throw new IllegalStateException(address + " returned a 404.");