Add static factory/accessor methods to LookupPath
Issue: SPR-15397
This commit is contained in:
@@ -41,7 +41,7 @@ public class UrlBasedCorsConfigurationSourceTests {
|
||||
@Test
|
||||
public void empty() {
|
||||
ServerWebExchange exchange = MockServerHttpRequest.get("/bar/test.html").toExchange();
|
||||
initLookupPath(exchange);
|
||||
LookupPath.getOrCreate(exchange, new HttpRequestPathHelper());
|
||||
assertNull(this.configSource.getCorsConfiguration(exchange));
|
||||
}
|
||||
|
||||
@@ -51,11 +51,11 @@ public class UrlBasedCorsConfigurationSourceTests {
|
||||
this.configSource.registerCorsConfiguration("/bar/**", config);
|
||||
|
||||
ServerWebExchange exchange = MockServerHttpRequest.get("/foo/test.html").toExchange();
|
||||
initLookupPath(exchange);
|
||||
LookupPath.getOrCreate(exchange, new HttpRequestPathHelper());
|
||||
assertNull(this.configSource.getCorsConfiguration(exchange));
|
||||
|
||||
exchange = MockServerHttpRequest.get("/bar/test.html").toExchange();
|
||||
initLookupPath(exchange);
|
||||
LookupPath.getOrCreate(exchange, new HttpRequestPathHelper());
|
||||
assertEquals(config, this.configSource.getCorsConfiguration(exchange));
|
||||
}
|
||||
|
||||
@@ -64,9 +64,4 @@ public class UrlBasedCorsConfigurationSourceTests {
|
||||
this.configSource.getCorsConfigurations().put("/**", new CorsConfiguration());
|
||||
}
|
||||
|
||||
private void initLookupPath(ServerWebExchange exchange) {
|
||||
exchange.getAttributes().put(LookupPath.LOOKUP_PATH_ATTRIBUTE,
|
||||
new HttpRequestPathHelper().getLookupPathForRequest(exchange));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user