fix(deploy): allow expanded authorization headers

This commit is contained in:
2026-08-10 12:07:03 +08:00
parent 1200ef54ad
commit 5c1c6a1a07
4 changed files with 36 additions and 1 deletions
@@ -0,0 +1,31 @@
package com.baiyue.gateway.config;
import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
class DeploymentHeaderSizeContractTest {
private static final String PROPERTY =
"max-http-request-header-size: ${SERVER_MAX_HTTP_REQUEST_HEADER_SIZE:32KB}";
private static final String ENVIRONMENT =
"SERVER_MAX_HTTP_REQUEST_HEADER_SIZE: ${SERVER_MAX_HTTP_REQUEST_HEADER_SIZE:-32KB}";
@Test
void allowsAuthorizationTokensAndTrustedIdentityHeadersAcrossAllServices() throws Exception {
assertThat(readRepositoryFile("deploy", "docker-compose.yml")).contains(ENVIRONMENT);
assertThat(readRepositoryFile("config", "nacos", "cn", "baiyue-common.yml")).contains(PROPERTY);
assertThat(readRepositoryFile("config", "nacos", "local", "baiyue-common.yml")).contains(PROPERTY);
}
private static String readRepositoryFile(String first, String... more) throws Exception {
Path path = Path.of(first, more);
if (!Files.exists(path)) {
path = Path.of("..").resolve(path).normalize();
}
return Files.readString(path, StandardCharsets.UTF_8);
}
}