Skip to content

Commit 2a8951e

Browse files
committed
[feature] enhance the dynamic url
1 parent ede0d06 commit 2a8951e

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/main/java/com/evolvedbinary/bblValidator/controller/SchemaController.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ public class SchemaController {
2626
@Produces(MediaType.APPLICATION_JSON)
2727
public List<SchemaInfo> listSchemas(final HttpRequest<?> request) {
2828
final String host = request.getHeaders().get("Host");
29-
final String path = request.getPath();
30-
final String url = request.getUri().toString(); // /schema
29+
final String path = request.getPath().replace("/schema", "/schema/");
3130
final String protocol = request.isSecure() ? "https://" : "http://";
31+
final String url = protocol + host + path;
3232

33-
// ${protocol}${host}/micronaut/schema/${id}
34-
3533
return schemaService.listSchemas().stream()
36-
.map(schema -> new SchemaInfo(schema.getId(), schema.getName(), schema.getVersion(), schema.getDate(), protocol + host + "/schema/" + schema.getId(), schema.getDescription()))
34+
.map(schema -> new SchemaInfo(schema.getId(), schema.getName(), schema.getVersion(), schema.getDate(), url + schema.getId(), schema.getDescription()))
3735
.collect(Collectors.toList());
3836
}
3937

0 commit comments

Comments
 (0)