<commit_before>package io.ktor.client.tests

import io.ktor.client.*
import io.ktor.client.features.*
import io.ktor.client.features.json.*
import io.ktor.client.features.json.serializer.*
import io.ktor.client.request.*
import io.ktor.client.tests.utils.*
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlin.test.*

@Serializable
data class HttpBinResponse(
    val url: String,
    val args: Map<String, String>,
    val headers: Map<String, String>
)

class HttpBinTest {

    @Test
    fun getTest() = clientsTest {
        config {
            testConfiguration()
        }

        test { client ->
            val response = client.get<HttpBinResponse>("http://httpbin.org/get")

            assertEquals("http://httpbin.org/get", response.url)
            assertEquals(emptyMap(), response.args)

            with(response.headers) {
                assertEquals("application/json", get("Accept"))
                assertEquals("close", get("Connection"))
                assertEquals("httpbin.org", get("Host"))
            }

        }
    }

    @Test
    fun postTest() = clientsTest {
        config {
            testConfiguration()
        }

        test { client ->
            val response = client.post<HttpBinResponse>("http://httpbin.org/post") {
                body = "Hello, bin!"
            }

            assertEquals("http://httpbin.org/post", response.url)
            assertEquals(emptyMap(), response.args)

            with(response.headers) {
                assertEquals("text/plain; charset=UTF-8", get("Content-Type"))
                assertEquals("application/json", get("Accept"))
                assertEquals("11", get("Content-Length"))
                assertEquals("close", get("Connection"))
                assertEquals("httpbin.org", get("Host"))
            }
        }
    }

    private fun HttpClientConfig<*>.testConfiguration() {
        install(JsonFeature) {
            serializer = KotlinxSerializer(Json.nonstrict).apply {
                register(HttpBinResponse.serializer())
            }
        }
    }
}
<commit_msg>Update httpbin tests to https<commit_after>package io.ktor.client.tests

import io.ktor.client.*
import io.ktor.client.features.*
import io.ktor.client.features.json.*
import io.ktor.client.features.json.serializer.*
import io.ktor.client.request.*
import io.ktor.client.tests.utils.*
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlin.test.*

@Serializable
data class HttpBinResponse(
    val url: String,
    val args: Map<String, String>,
    val headers: Map<String, String>
)

class HttpBinTest {

    @Test
    fun getTest() = clientsTest {
        config {
            testConfiguration()
        }

        test { client ->
            val response = client.get<HttpBinResponse>("https://httpbin.org/get")

            assertEquals("https://httpbin.org/get", response.url)
            assertEquals(emptyMap(), response.args)

            with(response.headers) {
                assertEquals("application/json", get("Accept"))
                assertEquals("httpbin.org", get("Host"))
            }

        }
    }

    @Test
    fun postTest() = clientsTest {
        config {
            testConfiguration()
        }

        test { client ->
            val response = client.post<HttpBinResponse>("https://httpbin.org/post") {
                body = "Hello, bin!"
            }

            assertEquals("https://httpbin.org/post", response.url)
            assertEquals(emptyMap(), response.args)

            with(response.headers) {
                assertEquals("text/plain; charset=UTF-8", get("Content-Type"))
                assertEquals("application/json", get("Accept"))
                assertEquals("11", get("Content-Length"))
                assertEquals("httpbin.org", get("Host"))
            }
        }
    }

    private fun HttpClientConfig<*>.testConfiguration() {
        install(JsonFeature) {
            serializer = KotlinxSerializer(Json.nonstrict).apply {
                register(HttpBinResponse.serializer())
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.12973760932944606, 'fraction_numerical': 0.0014577259475218659, 'mean_word_length': 2.0838951310861424, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6002643', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1085, 'n_words': 192}