Changes default of StripPrefix filter from 0 to 1.

Fixes gh-2033
This commit is contained in:
spencergibb
2021-07-27 22:31:17 -04:00
parent 16a29c1f2b
commit 51ff3685d6
3 changed files with 16 additions and 2 deletions

View File

@@ -96,7 +96,7 @@ public class StripPrefixGatewayFilterFactory
public static class Config {
private int parts;
private int parts = 1;
public int getParts() {
return parts;

View File

@@ -38,10 +38,15 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
public class StripPrefixGatewayFilterFactoryIntegrationTests extends BaseWebClientTests {
@Test
public void stripPrefixFilterDefaultValuesWork() {
public void stripPrefixFilterStripMultiplePartsValuesWork() {
testClient.get().uri("/foo/bar/get").header("Host", "www.stripprefix.org").exchange().expectStatus().isOk();
}
@Test
public void stripPrefixFilterDefaultPartsWork() {
testClient.get().uri("/foo/get").header("Host", "www.stripprefixdefault.org").exchange().expectStatus().isOk();
}
@EnableAutoConfiguration
@SpringBootConfiguration
@Import(DefaultTestConfig.class)

View File

@@ -429,6 +429,15 @@ spring:
filters:
- StripPrefix=2
# =====================================
- id: strip_prefix_default_test
uri: ${test.uri}
predicates:
- Host=**.stripprefixdefault.org
- Path=/foo/**
filters:
- StripPrefix
# =====================================
- id: rewrite_path_test
uri: ${test.uri}