Repository: ktorio/ktor
File: ktor-client/ktor-client-core/common/src/io/ktor/client/HttpClientConfig.kt (Kotlin)

Code before:
 * ```
 * ## Configuring [HttpClientEngine]
 *
 * If the engine is specified explicitly, engine-specific properties will be available in the engine block:
 * ```kotlin
 * val client = HttpClient(CIO) { // HttpClientConfig<CIOEngineConfig>.() -> Unit
 *     engine { // CIOEngineConfig.() -> Unit
 *         // engine specific properties
 *     }
 * }
 * ```
 *
 * Learn more about the client's configuration from
 * [Creating and configuring a client](https://ktor.io/docs/create-client.html).
 */
@KtorDsl
public class HttpClientConfig<T : HttpClientEngineConfig> {
    private val plugins: MutableMap<AttributeKey<*>, (HttpClient) -> Unit> = mutableMapOf()
    private val pluginConfigurations: MutableMap<AttributeKey<*>, Any.() -> Unit> = mutableMapOf()
    private val customInterceptors: MutableMap<String, (HttpClient) -> Unit> = mutableMapOf()

    internal var engineConfig: T.() -> Unit = {}

    /**
     * Builder for configuring engine-specific settings in [HttpClientEngineConfig]
     * (like dispatcher, threads count, proxy, etc.)
     *
     * ```kotlin
     * val client = HttpClient(CIO) { // HttpClientConfig<CIOEngineConfig>
     *     engine { // CIOEngineConfig.() -> Unit
     *         proxy = ProxyBuilder.http("proxy.example.com", 8080)
     *     }
     * ```
     *
     * You can learn more from [Engines](https://ktor.io/docs/http-client-engines.html).
     */
    public fun engine(block: T.() -> Unit) {
        val oldConfig = engineConfig
        engineConfig = {
            oldConfig()
            block()
        }
    }

    /**
     * Specifies whether the client redirects to URLs provided in the `Location` header.
     * You can disable redirections by setting this property to `false`.
     *
     * For the advanced redirection configuration, use [HttpRedirect] plugin.
     */
    public var followRedirects: Boolean = true

Review comment (suggestion):
```suggestion
     * such as dispatcher, thread count, proxy, and more.
```

Code after:
 * ```
 * ## Configuring [HttpClientEngine]
 *
 * If the engine is specified explicitly, engine-specific properties will be available in the `engine` block:
 * ```kotlin
 * val client = HttpClient(CIO) { // HttpClientConfig<CIOEngineConfig>.() -> Unit
 *     engine { // CIOEngineConfig.() -> Unit
 *         // engine specific properties
 *     }
 * }
 * ```
 *
 * Learn more about the client's configuration from
 * [Creating and configuring a client](https://ktor.io/docs/create-client.html).
 */
@KtorDsl
public class HttpClientConfig<T : HttpClientEngineConfig> {
    private val plugins: MutableMap<AttributeKey<*>, (HttpClient) -> Unit> = mutableMapOf()
    private val pluginConfigurations: MutableMap<AttributeKey<*>, Any.() -> Unit> = mutableMapOf()
    private val customInterceptors: MutableMap<String, (HttpClient) -> Unit> = mutableMapOf()

    internal var engineConfig: T.() -> Unit = {}

    /**
     * A builder for configuring engine-specific settings in [HttpClientEngineConfig],
     * such as dispatcher, thread count, proxy, and more.
     *
     * ```kotlin
     * val client = HttpClient(CIO) { // HttpClientConfig<CIOEngineConfig>
     *     engine { // CIOEngineConfig.() -> Unit
     *         proxy = ProxyBuilder.http("proxy.example.com", 8080)
     *     }
     * ```
     *
     * You can learn more from [Engines](https://ktor.io/docs/http-client-engines.html).
     */
    public fun engine(block: T.() -> Unit) {
        val oldConfig = engineConfig
        engineConfig = {
            oldConfig()
            block()
        }
    }

    /**
     * Specifies whether the client redirects to URLs provided in the `Location` header.
     * You can disable redirections by setting this property to `false`.
     *
     * For an advanced redirection configuration, use the [HttpRedirect] plugin.
     */
    public var followRedirects: Boolean = true