Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
import io.dropwizard.testing.ResourceHelpers;
import io.dropwizard.testing.junit5.DropwizardAppExtension;
import io.dropwizard.testing.junit5.DropwizardExtensionsSupport;
import jakarta.ws.rs.ProcessingException;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.client.Invocation;
import jakarta.ws.rs.core.Response;
import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -674,39 +672,6 @@ public void testWarehouseNotSpecified() throws IOException {
}
}

@Test
public void testRequestHeaderTooLarge() {
Invocation.Builder request =
EXT.client()
.target(
String.format(
"http://localhost:%d/api/management/v1/principal-roles", EXT.getLocalPort()))
.request("application/json");

// The default limit is 8KiB and each of these headers is at least 8 bytes, so 1500 definitely
// exceeds the limit
for (int i = 0; i < 1500; i++) {
request = request.header("header" + i, "" + i);
}

try {
try (Response response =
request
.header("Authorization", "Bearer " + userToken)
.header(REALM_PROPERTY_KEY, realm)
.post(Entity.json(new PrincipalRole("r")))) {
assertThat(response)
.returns(
Response.Status.REQUEST_HEADER_FIELDS_TOO_LARGE.getStatusCode(),
Response::getStatus);
}
} catch (ProcessingException e) {
// In some runtime environments the request above will return a 431 but in others it'll result
// in a ProcessingException from the socket being closed. The test asserts that one of those
// things happens.
}
}

@Test
public void testRequestBodyTooLarge() {
// The size is set to be higher than the limit in polaris-server-integrationtest.yml
Expand Down
Loading