what exactly does call.respond() do? does it end t...
# ktor
s
what exactly does call.respond() do? does it end the current pipeline or should I use it with an explicit return call?
Copy code
delete("{id}") {
            val id = call.parameters["id"]?.toInt() ?: call.respondText(
                "Missing or malformed id",
                status = HttpStatusCode.BadRequest
            )
            ...
        }
vs
Copy code
delete("{id}") {
            val id = call.parameters["id"]?.toInt() ?: return@delete call.respondText(
                "Missing or malformed id",
                status = HttpStatusCode.BadRequest
            )
            ...
        }
nvm I have to, otherwise I can't use
id
a
The
call.respond()
call executes the
ApplicationSendPipeline
that has the
Engine
phase where actual sending of a response happens.
s
yeah I traced it down but does it like close the request afterwards or would code after a
call.respond()
within e.g.
delete{ }
keep going?
okay now it seems like it does. I've lost myself in the coroutine debugger earlier, hence why I got weird mixed results. my bad
a
The code will be executed after responding but a response won’t be affected.
I mean you can’t change it after responding.
s
ah yeah that makes sense