mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-06-01 23:45:28 +00:00
15 lines
320 B
Kotlin
15 lines
320 B
Kotlin
package dev.inmo.micro_utils.ktor.common
|
|
|
|
private val schemaRegex = Regex("[^:]*//")
|
|
|
|
val String.asCorrectWebSocketUrl: String
|
|
get() = if (startsWith("ws")) {
|
|
this
|
|
} else {
|
|
if (contains("://")) {
|
|
replace(schemaRegex, "ws://")
|
|
} else {
|
|
"ws://$this"
|
|
}
|
|
}
|