From e45a23ea80ce74559e2480994e96ad538e27f658 Mon Sep 17 00:00:00 2001 From: Ali Albaali Date: Sat, 23 Jul 2022 23:09:33 +0300 Subject: [PATCH] Add a function that takes HttpClient as a parameter #16 --- .../kotlin/io/kamel/core/config/KamelConfigBuilder.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kamel-core/src/commonMain/kotlin/io/kamel/core/config/KamelConfigBuilder.kt b/kamel-core/src/commonMain/kotlin/io/kamel/core/config/KamelConfigBuilder.kt index 6c174d33..8ba00f96 100644 --- a/kamel-core/src/commonMain/kotlin/io/kamel/core/config/KamelConfigBuilder.kt +++ b/kamel-core/src/commonMain/kotlin/io/kamel/core/config/KamelConfigBuilder.kt @@ -63,6 +63,11 @@ public class KamelConfigBuilder { } +/** + * Adds an Http fetcher to the [KamelConfigBuilder] using the specified [client]. + */ +public fun KamelConfigBuilder.httpFetcher(client: HttpClient): Unit = fetcher(HttpFetcher(client)) + /** * Adds an Http fetcher to the [KamelConfigBuilder] using the specified [engine] * and an optional [block] for configuring this client. @@ -103,7 +108,8 @@ public fun KamelConfigBuilder.urlMapper(): Unit = mapper(URLMapper) /** * Copies all the data from [builder] and uses it as base for [this]. */ -public fun KamelConfigBuilder.takeFrom(builder: KamelConfigBuilder): KamelConfigBuilder = takeFrom(builder.build()) +public fun KamelConfigBuilder.takeFrom(builder: KamelConfigBuilder): KamelConfigBuilder = + takeFrom(builder.build()) /** * Copies all the data from [config] and uses it as base for [this].