How can a path param like `get("/{id}")` be enforc...
# ktor
d
How can a path param like
get("/{id}")
be enforced to be an
Int
and be casted as one in
call.parameters["id"]
? I looked at the docs, but don't see any mention of this... or maybe I missed it @Deactivated User?
d
I didn’t update the routing page yet
You can use either the locations feature to get typed parameters
d
Oh
Coming soon...
... 🤕, any little clue how I would do this in my case?
d
Or just manually convert to integer. “string”.toInt() or --> “string”.toIntOrNull() ?: 0 if you want to handle the string not being an integer
d
I guess I'll try that, thanks!
have a look to those samples that use the location feature in the mean time
d
It might be nice to add links to the samples for all the coming soon sections... at least that would give a pointer in the meantime, what do you think?
It's a bit less work than writing all the docs at once, but would avoid people unfamiliar with the sources in having to search for all that 🙂
d
I plan to fill all the features in the coming days. But yeah, even if they have content, I can put links to samples 🙂 that would help people to see how to use them with a bit more context
👍🏼 1
d
Thanks @Deactivated User, that's perfect! 😃
simple smile 1