@@ -18,7 +18,8 @@ class Client internal constructor(
1818 private val authorization : Authorization ,
1919 private val apiUrl : String ,
2020 private val httpClient : HttpClient ,
21- private val serializer : Json
21+ private val serializer : Json ,
22+ private val customHeaders : Map <String , String >
2223) {
2324 val paymentClient by lazy { PaymentClient (httpClient = httpClient.withAuthorization()) }
2425 val authClient by lazy { AuthClient (httpClient = httpClient.withAuthorization()) }
@@ -27,12 +28,14 @@ class Client internal constructor(
2728
2829 constructor (
2930 authorization: Authorization ,
30- apiUrl: String = Endpoint .BASE
31+ apiUrl: String = Endpoint .BASE ,
32+ customHeaders: Map <String , String > = mapOf ()
3133 ) : this (
3234 authorization = authorization,
3335 apiUrl = apiUrl,
3436 httpClient = Dependencies .httpClient,
35- serializer = Dependencies .serializer
37+ serializer = Dependencies .serializer,
38+ customHeaders = customHeaders
3639 )
3740
3841 private fun HttpClient.withAuthorization () = this .config {
@@ -46,6 +49,7 @@ class Client internal constructor(
4649 )
4750 header(" Client-Id" , authorization.clientId)
4851 header(" Client-Secret" , authorization.clientSecret)
52+ customHeaders.forEach { header(it.key, it.value) }
4953 }
5054 }
5155}
0 commit comments