diff --git a/ktor-client/ktor-client-tests/build.gradle.kts b/ktor-client/ktor-client-tests/build.gradle.kts index 27d61eed172..838adbb4543 100644 --- a/ktor-client/ktor-client-tests/build.gradle.kts +++ b/ktor-client/ktor-client-tests/build.gradle.kts @@ -81,26 +81,15 @@ kotlin.sourceSets { if (!ideaActive) { listOf("linuxX64Test", "mingwX64Test", "macosX64Test").map { getByName(it) }.forEach { it.dependencies { - api(project(":ktor-client:ktor-client-curl")) - } - } - - listOf("iosX64Test", "iosArm64Test", "iosArm64Test", "macosX64Test").map { getByName(it) }.forEach { - it.dependencies { - api(project(":ktor-client:ktor-client-ios")) +// api(project(":ktor-client:ktor-client-curl")) } } } else { posixTest { dependencies { - api(project(":ktor-client:ktor-client-curl")) +// api(project(":ktor-client:ktor-client-curl")) } } -// darwinTest { -// dependencies { -// api(project(":ktor-client:ktor-client-ios")) -// } -// } } } diff --git a/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/ProxyTest.kt b/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/ProxyTest.kt index 8db03f228d6..5bacd5f8ff8 100644 --- a/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/ProxyTest.kt +++ b/ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/ProxyTest.kt @@ -41,8 +41,8 @@ class ProxyTest : ClientLoader() { } test { client -> - val response = client.get("http://google.com") - val expected = ProxyResponse("OK") + val response = client.get("http://google.com/json") + val expected = ProxyResponse("ok") assertEquals(expected, response) } diff --git a/ktor-client/ktor-client-tests/jvm/src/io/ktor/client/tests/utils/tests/Proxy.kt b/ktor-client/ktor-client-tests/jvm/src/io/ktor/client/tests/utils/tests/Proxy.kt index 4c331a2e3e2..aebcd9b8121 100644 --- a/ktor-client/ktor-client-tests/jvm/src/io/ktor/client/tests/utils/tests/Proxy.kt +++ b/ktor-client/ktor-client-tests/jvm/src/io/ktor/client/tests/utils/tests/Proxy.kt @@ -4,6 +4,7 @@ package io.ktor.client.tests.utils.tests +import io.ktor.client.utils.* import io.ktor.http.* import io.ktor.network.sockets.* import io.ktor.utils.io.* @@ -16,7 +17,11 @@ suspend fun proxyHandler(socket: Socket) { val response = when (statusLine) { "GET http://google.com/ HTTP/1.1" -> buildResponse(HttpStatusCode.OK) - "GET http://google.com/json HTTP/1.1" -> buildResponse(HttpStatusCode.OK, "{'status': 'ok'}") + "GET http://google.com/json HTTP/1.1" -> buildResponse( + HttpStatusCode.OK, buildHeaders { + append(HttpHeaders.ContentType, ContentType.Application.Json) + }, "{\"status\": \"ok\"}" + ) else -> buildResponse(HttpStatusCode.BadRequest) } @@ -28,9 +33,16 @@ suspend fun proxyHandler(socket: Socket) { } } -private fun buildResponse(status: HttpStatusCode, body: String = "proxy") = buildString { +private fun buildResponse( + status: HttpStatusCode, + headers: Headers = Headers.Empty, + body: String = "proxy" +): String = buildString { append("HTTP/1.1 ${status.value} ${status.description}\r\n") append("Connection: close\r\n") + headers.forEach { key, values -> + append("$key: ${values.joinToString()}\r\n") + } append("\r\n") append(body) }