Checks for null value if query parameter does not have a value
fixes gh-423
This commit is contained in:
@@ -58,7 +58,7 @@ public class QueryRoutePredicateFactory extends AbstractRoutePredicateFactory<Qu
|
||||
return false;
|
||||
}
|
||||
for (String value : values) {
|
||||
if (value.matches(config.regexp)) {
|
||||
if (value != null && value.matches(config.regexp)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,16 @@ public class QueryRoutePredicateFactoryTests extends BaseWebClientTests {
|
||||
.expectHeader().valueEquals(ROUTE_ID_HEADER, "foo_query_param");;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyQueryParamWorks() {
|
||||
testClient.get().uri("/get?foo")
|
||||
.exchange()
|
||||
.expectStatus().isOk()
|
||||
.expectHeader().valueEquals(ROUTE_ID_HEADER, "default_path_to_httpbin");;
|
||||
|
||||
output.expect(not(containsString("Error applying predicate for route: foo_query_param")));
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootConfiguration
|
||||
@Import(DefaultTestConfig.class)
|
||||
|
||||
Reference in New Issue
Block a user