<@UE6N32F8T> Yes, I was confused by that at the st...
# ktor
f
@ketilsan Yes, I was confused by that at the start too. You dont return anything like a response object, you just call call.respond and passalong what you want returned.
k
yeah, thats what I did. But I was wondering if this was by design by the Ktor-team, I would have thought that a response in the 5xx-range would be more "correct"? I might be wront tho 🙂
f
Aha you mean about the 404, that I cannot answer
đź‘Ť 1
d
Or maybe a timeout error... or does the server keep that request active forever?
o
There were lots of debates, but currently we don’t have a better idea. In a routing we cannot know if it’s ok to not handle a request, because there could be features/interceptors installed that might want to handle it. So if a routing handler matched, but decided not to respond, there could be something else that is meant to handle it. And we cannot distinguish between when it is an error or intended behavior.
k
Ok! I understand, thanks for responding!
o
We would like to do better 🙂 If you have any ideas, please share!
Obvious thing is to make an “option”, e.g. configure routing to “require response if matched”, but settings are evil – as soon as you have one, blink, and you have hundreds.
d
What about some kind of timeout
Feature
that makes it opt-in to timeout a request when no reply was given. It could possibly be enabled globally or used in routing
withTimeout(300) { get { ...} ... }
@orangy?
o
I’m not sure I understand what it has to do with a timeout?
d
Maybe I misunderstood, if
call.respond()
hasn't been called, I thought the request would be "waiting" around until something calls it. But it seems like I didn't notice that the original comment is that a 404 is returned... I guess a 404 doesn't make sense in this case since a route was actually matched, so I guess I could change my proposition that there could be an opt-in Feature to “require response if matched” and similar, instead of "evil" options...?
Or maybe an addition to
StatusPages
that allows catching an error that
call.respond()
wasn't called?
o
StatusPages
is actually a nice idea! May be a special
unhandled
handler that will execute if response wasn’t sent…
Can someone file an issue on github please?
k
I can do that, sec
I like the statuspage-idea as well 🙂
add your suggustion if you like, Dave
d
Done 🙂
k
perfect!