Skip to content

Commit 20a6574

Browse files
committed
Deprecated: URL -> URI
1 parent 8df56d8 commit 20a6574

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

common/src/main/kotlin/com/lambda/http/Request.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.lambda.util.FolderRegister.cache
2222
import com.lambda.util.FolderRegister.createIfNotExists
2323
import java.io.File
2424
import java.net.HttpURLConnection
25+
import java.net.URI
2526
import java.net.URL
2627
import kotlin.time.Duration
2728
import kotlin.time.Duration.Companion.days
@@ -63,10 +64,10 @@ data class Request(
6364

6465
file.writeText("") // Clear the file before writing to it.
6566

66-
val url = URL(
67+
val url = URI(
6768
if (parameters.isNotEmpty() && canBeEncoded) "$url?${parameters.query}"
6869
else url
69-
)
70+
).toURL()
7071

7172
val connection = url.openConnection() as HttpURLConnection
7273
config.invoke(connection)
@@ -90,10 +91,10 @@ data class Request(
9091
* Executes the HTTP request synchronously.
9192
*/
9293
inline fun <reified Success : Any> json(): Response<Success> {
93-
val url = URL(
94+
val url = URI(
9495
if (parameters.isNotEmpty() && canBeEncoded) "$url?${parameters.query}"
9596
else url
96-
)
97+
).toURL()
9798

9899
val connection = url.openConnection() as HttpURLConnection
99100
config.invoke(connection)

0 commit comments

Comments
 (0)