validate

fun Url.validate(): Url

Helper functions that validate, whether URL is in "valid" format. It works by converting io.ktor.http.Url into okhttp3.HttpUrl and accepting only 'http' and 'https' as valid schemes.

Throws

in case of host == "localhost" or scheme is not 'http' ir 'https'

or any exception that okhttp3.HttpUrl.Companion.toHttpUrl throws