WIP
authorKai Moritz <kai@juplo.de>
Sun, 12 Jul 2020 09:23:59 +0000 (11:23 +0200)
committerKai Moritz <kai@juplo.de>
Sun, 12 Jul 2020 09:23:59 +0000 (11:23 +0200)
src/main/java/de/trion/kafka/outbox/OutboxController.java

index 78d4999..f1119f2 100644 (file)
@@ -30,10 +30,11 @@ public class OutboxController {
     public ResponseEntity<Void> getVorgang(
             UriComponentsBuilder builder,
             @RequestBody String username) {
-        User user = new User(username, LocalDateTime.now(), false);
+        String cleaned = username.trim().toLowerCase();
+        User user = new User(cleaned, LocalDateTime.now(), false);
         repository.save(user);
         // TODO: Not-Unique Fehler auslösen
-        UriComponents uri = builder.path("/{username}").buildAndExpand(username);
+        UriComponents uri = builder.path("{username}").buildAndExpand(cleaned);
         return ResponseEntity.created(uri.toUri()).build();
     }
 }