add core view extension with JTE and Thymeleaf support
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>dev.relism</groupId>
|
||||
<artifactId>flash-extensions</artifactId>
|
||||
<version>1.1-indev5</version>
|
||||
<version>1.1-indev6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>flash-ext-openapi</artifactId>
|
||||
|
||||
+5
-1
@@ -344,7 +344,11 @@ public final class OpenApiBuilder {
|
||||
}
|
||||
|
||||
private static String normalizePath(String path) {
|
||||
return path.startsWith("/") ? path : "/" + path;
|
||||
String normalized = path.startsWith("/") ? path : "/" + path;
|
||||
while (normalized.startsWith("//")) {
|
||||
normalized = normalized.substring(1);
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
private static String defaultDescription(int status) {
|
||||
|
||||
+15
@@ -108,6 +108,21 @@ class OpenApiExtensionTest {
|
||||
assertFalse(paths.containsKey("/users"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void normalizes_double_slash_paths_from_events() {
|
||||
FlashContext ctx = new FlashContext();
|
||||
OpenApiExtension ext = new OpenApiExtension();
|
||||
ext.provide(ctx);
|
||||
|
||||
emitRoute(ctx, HttpMethod.GET, "//blogs", "/", ScopedUsersHandler.class);
|
||||
|
||||
OpenApiBuilder builder = ctx.require(OpenApiBuilder.class);
|
||||
Map<String, Object> spec = builder.build();
|
||||
Map<String, Object> paths = cast(spec.get("paths"));
|
||||
assertTrue(paths.containsKey("/blogs"));
|
||||
assertFalse(paths.containsKey("//blogs"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static List<RouteListener> listeners(FlashContext ctx) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user