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

Peter Ertl

12/17/2020, 3:45 PM
what is the correct way to render a “HTTP 204 No Content” response in ktor? The problem seems so easy but I can’t find any non-trivial solution to it.
p

Peter Ertl

12/17/2020, 3:48 PM
wow, I was always looking for something like content = NoContent but this is just nice
thanks @Matteo Mirk
m

Matteo Mirk

12/17/2020, 3:49 PM
you’re welcome! Just take a look at Ktor docs, they cover almost all of its API with examples
👍 1
p

Peter Ertl

12/17/2020, 3:49 PM
I did but somehow I managed to NOT find it 🙂
m

Matteo Mirk

12/17/2020, 3:51 PM
the code I showed you just sets the response status and the body remains empty, provided that’s the only or last statement in your route handler that manipulates the response
p

Peter Ertl

12/17/2020, 3:51 PM
exactly what I needs … thanks a lot
m

Matteo Mirk

12/17/2020, 3:51 PM
I did but somehow I managed to NOT find it
don’t worry, some things are a little hidden in the docs or mentioned in just a sentence, which is a pity
p

Peter Ertl

12/17/2020, 3:52 PM
still ktor rocks heavy!! we did not use spring boot in the current company’s project (and they all use it despite the bloat 🙂 ) and I can’t tell you how happy we are.
m

Matteo Mirk

12/17/2020, 3:58 PM
I know! I started using Ktor just after learning kotlin basics and really love it! Even if Kotlin is being adopted in my company, I cannot use it currently and I’m stuck working with legacy Spring boot apps. +1 for choosing ktor over Spring! 👍
p

Peter Ertl

12/17/2020, 4:00 PM
it’s the fresh breeze we all were waiting for after years of bloated containers, annotation driven code, bytecode instrumentation und bloated libraries 🙂
🎊 1
3 Views