https://kotlinlang.org logo
#ktor
Title
# ktor
d

Deactivated

03/05/2019, 10:05 AM
I was playing with routing declarations and I would like to know whether these scenarios are valid from your point of view: Scenario1
Copy code
routing {
    route("/todo", <http://HttpMethod.Post|HttpMethod.Post>) {
        handle { println("POST /todo") }
        route("/list", HttpMethod.Get) {
            handle { println("GET /todo/list") }
        }
    }
}
Scenario2
Copy code
routing {
    method(<http://HttpMethod.Post|HttpMethod.Post>) {
        route("/todo") {
            handle { println("POST /todo") }
            method(HttpMethod.Get) {
                route("/list") {
                    handle { println("GET /todo/list") }
                }
            }
        }
    }
}
Both only work with
POST /todo
d

david-wg2

03/05/2019, 10:12 AM
in both examples you have a POST wrapped around a GET, what is that supposed to mean?
d

Deactivated

03/05/2019, 10:31 AM
I just kind of expect the same behavior as for:
Copy code
routing {
        route("/todo") {
            post { println("POST /todo") }
            route("/list") {
                handle { println("POST /todo/list") }
                get { println("GET /todo/list") }
            }
        }
    }
which generates:
POST /todo
POST /todo/list
GET /todo/list
Here I can inherit the http method from the parent and add an individual http method for the nested path as well