From 5161cc8a3882e7a7a80390cb05620d6e0415060d Mon Sep 17 00:00:00 2001
From: Torsten Grote <t@grobox.de>
Date: Wed, 29 Sep 2021 16:15:14 +0200
Subject: [PATCH] Consistent use of slashes in routing

---
 .../org/briarproject/mailbox/core/server/Routing.kt    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/Routing.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/Routing.kt
index cfe68937..62a8a2be 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/Routing.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/Routing.kt
@@ -14,10 +14,10 @@ import io.ktor.routing.put
 import io.ktor.routing.route
 import io.ktor.routing.routing
 
-internal const val V = "" // TODO set to "/v1" for release
+internal const val V = "/" // TODO set to "/v1" for release
 
 internal fun Application.configureBasicApi() = routing {
-    route("$V/") {
+    route(V) {
         get {
             call.respondText("Hello world!", ContentType.Text.Plain)
         }
@@ -25,7 +25,7 @@ internal fun Application.configureBasicApi() = routing {
             delete {
                 call.respond(HttpStatusCode.OK, "delete: Not yet implemented")
             }
-            put("setup") {
+            put("/setup") {
                 call.respond(HttpStatusCode.OK, "put: Not yet implemented")
             }
         }
@@ -35,14 +35,14 @@ internal fun Application.configureBasicApi() = routing {
 internal fun Application.configureContactApi() = routing {
     authenticate(AuthContext.ownerOnly) {
         route("$V/contacts") {
-            put("{contactId}") {
+            put("/{contactId}") {
                 call.respond(
                     HttpStatusCode.OK,
                     "get: Not yet implemented. " +
                         "contactId: ${call.parameters["contactId"]}"
                 )
             }
-            delete("{contactId}") {
+            delete("/{contactId}") {
                 call.respond(
                     HttpStatusCode.OK,
                     "delete: Not yet implemented. " +
-- 
GitLab