https://kotlinlang.org logo
Title
m

Marc Knaup

06/26/2019, 10:54 AM
Do I assume correctly that Ktor's
Url
is only to be used for HTTP-based URLs? It messes up URLs with other schemes like
file
or
custom
. (It should probably be called
HttpUrl
in that case 🤔)
e

e5l

06/26/2019, 12:52 PM
Hi @Marc Knaup, it’s not specific to http 🙂. The protocol part of url(
URLProtocol
) is data class with a public constructor.
m

Marc Knaup

06/26/2019, 12:55 PM
So the following two examples would be considered a bug then?
Url("<mailto:marc@knaup.io>").toString() // "<mailto://localhost/marc@knaup.io>"
Url("file:///var/www").toString() // "<file://var/www>"
e

e5l

06/26/2019, 12:56 PM
Yep, it looks like the bug in parser. Btw it should be possible to create url with a custom protocol with the default constructor.
m

Marc Knaup

06/26/2019, 12:57 PM
Alright, thanks you 🙂 I'll file a bug.
e

e5l

06/26/2019, 12:57 PM
Awesome, thanks 🙂 We also accept PRs 😉
😁 1
m

Marc Knaup

06/26/2019, 1:01 PM