Changes default of StripPrefix filter from 0 to 1.
Fixes gh-2033
This commit is contained in:
@@ -96,7 +96,7 @@ public class StripPrefixGatewayFilterFactory
|
||||
|
||||
public static class Config {
|
||||
|
||||
private int parts;
|
||||
private int parts = 1;
|
||||
|
||||
public int getParts() {
|
||||
return parts;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user