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

Vinicius Carvalho

09/10/2019, 2:24 AM
Hi folks, a few months ago I've asked about how to get the hostname/port and @cy was kind enough to point me out that it's not possible. I have a similar question again, this time I need to find a way to simulate the same behavior as one would have if running a Servlet and using
getRequestUrl + getQueryString
, I know how to obtain the path of a given
route
, and the query string, it's also possible to find the
host
, but I could not find a way to determine the full original request as in
<scheme://host:<port>/path?query>
Is it possible (even without port for now, at least scheme would be nice to have)
p

Pavel Lechev

09/10/2019, 9:30 AM
Have you looked at
io.ktor.http.RequestConnectionPoint
which is accessible from inside your routes via
io.ktor.request.ApplicationRequest#local
?
v

Vinicius Carvalho

09/10/2019, 12:56 PM
Thank you Pavel that really did the trick 🙂
👍 1