mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-02-08 08:21:30 +01:00
Don't accept redirect in https test
This commit is contained in:
parent
8dccb060c0
commit
b1a63d57b6
@ -52,7 +52,7 @@ interface HttpsServerTest {
|
|||||||
String address = "https://localhost:" + testPortNumber();
|
String address = "https://localhost:" + testPortNumber();
|
||||||
|
|
||||||
String cookie = login(address);
|
String cookie = login(address);
|
||||||
testAccess(address, cookie);
|
testAccess(address + "/server/Server%201", cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void testAccess(String address, String cookie) throws IOException, KeyManagementException, NoSuchAlgorithmException {
|
default void testAccess(String address, String cookie) throws IOException, KeyManagementException, NoSuchAlgorithmException {
|
||||||
@ -64,7 +64,8 @@ interface HttpsServerTest {
|
|||||||
int responseCode = connection.getResponseCode();
|
int responseCode = connection.getResponseCode();
|
||||||
|
|
||||||
switch (responseCode) {
|
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 400 -> throw new IllegalStateException("Bad Request: " + address);
|
||||||
case 403 -> throw new IllegalStateException(address + " returned 403");
|
case 403 -> throw new IllegalStateException(address + " returned 403");
|
||||||
case 404 -> throw new IllegalStateException(address + " returned a 404.");
|
case 404 -> throw new IllegalStateException(address + " returned a 404.");
|
||||||
|
Loading…
Reference in New Issue
Block a user