Skip to content

Commit

Permalink
Fix warnings in test-server
Browse files Browse the repository at this point in the history
  • Loading branch information
osipxd committed Dec 27, 2024
1 parent 7412603 commit 152f086
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

package test.server

import io.ktor.client.tests.utils.tests.*
import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.plugins.defaultheaders.*
Expand Down
4 changes: 2 additions & 2 deletions ktor-test-server/src/main/kotlin/test/server/ServerUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import io.ktor.http.*
import io.ktor.http.content.*
import io.ktor.util.*
import io.ktor.utils.io.*
import io.ktor.utils.io.core.*
import kotlinx.io.readByteArray

fun makeArray(size: Int): ByteArray = ByteArray(size) { it.toByte() }

Expand All @@ -32,6 +32,6 @@ internal suspend fun filenameContentTypeAndContentString(provider: () -> ByteRea
val disposition: ContentDisposition = ContentDisposition.parse(dispositionHeader)
val filename: String = disposition.parameter("filename") ?: ""
val contentType = headers[HttpHeaders.ContentType]?.let { ContentType.parse(it) } ?: ""
val content: String = provider().readRemaining().readBytes().let { "Content of ${it.size} bytes" }
val content: String = provider().readRemaining().readByteArray().let { "Content of ${it.size} bytes" }
return "$filename$contentType$content"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,16 @@
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

package io.ktor.client.tests.utils.tests
package test.server.tests

import io.ktor.server.application.*
import io.ktor.server.http.content.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
import test.server.tests.counter

internal fun Application.multithreadedTest() {
routing {
route("multithreaded") {
get {
call.respondText(counter.incrementAndGet().toString())
}
static {
resource("jarfile", "String.class", "java.lang")
}
get("multithreaded") {
call.respondText(counter.incrementAndGet().toString())
}
}
}

0 comments on commit 152f086

Please sign in to comment.