Reconsider AntPathRequestMatcher matching logic
Closes gh-9285
This commit is contained in:
committed by
Josh Cummings
parent
f36e2fca59
commit
77484018bb
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,6 +32,7 @@ import static org.mockito.BDDMockito.given;
|
||||
/**
|
||||
* @author Luke Taylor
|
||||
* @author Rob Winch
|
||||
* @author Evgeniy Cheban
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class AntPathRequestMatcherTests {
|
||||
@@ -196,6 +197,14 @@ public class AntPathRequestMatcherTests {
|
||||
assertThat(matcher.matches(request)).isFalse();
|
||||
}
|
||||
|
||||
// gh-9285
|
||||
@Test
|
||||
public void matcherWhenMatchAllPatternThenMatchResult() {
|
||||
AntPathRequestMatcher matcher = new AntPathRequestMatcher("/**");
|
||||
MockHttpServletRequest request = createRequest("/blah");
|
||||
assertThat(matcher.matcher(request).isMatch()).isTrue();
|
||||
}
|
||||
|
||||
private HttpServletRequest createRequestWithNullMethod(String path) {
|
||||
given(this.request.getServletPath()).willReturn(path);
|
||||
return this.request;
|
||||
|
||||
Reference in New Issue
Block a user