Skip to content

Commit

Permalink
Update Ktor to 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gdude2002 committed Oct 15, 2024
1 parent 6ec1f6f commit b5dc02a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ kaml = "0.61.0"
koin = "3.5.6"
kord = "0.15.0-SNAPSHOT"
ksp = "2.0.20-1.0.24"
ktor = "2.3.12"
ktor = "3.0.0"
kx-coro = "1.8.1"
kx-ser = "1.7.2"
linkie = "1.0.121"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.utils.io.core.*
import io.ktor.utils.io.jvm.javaio.*
import io.ktor.utils.io.readRemaining
import kotlinx.io.readByteArray
import java.io.File
import java.nio.file.Path
import kotlin.io.path.*
Expand All @@ -32,7 +34,7 @@ public suspend fun Attachment.download(): ByteArray {
val channel = client.get(this.url)
val packet = channel.bodyAsChannel()

return packet.readRemaining().readBytes()
return packet.readRemaining().readByteArray()
}

/** Given a [String] representing a file path, download the attachment to the file it points to. **/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ import dev.kordex.core.koin.KordExKoinComponent
import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.response.*
import io.ktor.server.routing.RoutingContext
import io.ktor.util.pipeline.*

public class RouteRegistry : KordExKoinComponent {
private val routes: MutableMap<String, Route> = mutableMapOf()

public suspend fun handle(verb: Verb, context: PipelineContext<Unit, ApplicationCall>) {
public suspend fun handle(verb: Verb, context: RoutingContext) {
val call = context.call

val path = call.parameters.getAll("path")
Expand Down

0 comments on commit b5dc02a

Please sign in to comment.