Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
anssari1 committed Aug 27, 2024
1 parent 6208344 commit 0fae1eb
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ import com.expediagroup.sdk.core.model.Properties
import com.expediagroup.sdk.core.model.TransactionId
import io.ktor.client.request.HttpRequestBuilder
import io.ktor.http.HttpHeaders
import java.util.UUID

interface EnvironmentProvider {
fun HttpRequestBuilder.appendHeaders(transactionId: TransactionId = TransactionId())
fun HttpRequestBuilder.appendHeaders(extraHeaders: Map<String, String> = mapOf(HeaderKey.TRANSACTION_ID to TransactionId().dequeue().toString()))
}

class DefaultEnvironmentProvider(
Expand All @@ -36,11 +35,11 @@ class DefaultEnvironmentProvider(
private val userAgent = "expediagroup-sdk-java-$namespace/${properties["sdk-version"]!!} (Java $javaVersion; $operatingSystemName $operatingSystemVersion)"

@Suppress("MemberVisibilityCanBePrivate")
override fun HttpRequestBuilder.appendHeaders(transactionId: TransactionId) {
override fun HttpRequestBuilder.appendHeaders(extraHeaders: Map<String, String>) {
with(headers) {
append(HttpHeaders.UserAgent, userAgent)
append(HeaderKey.X_SDK_TITLE, properties["sdk-title"]!!)
append(HeaderKey.TRANSACTION_ID, transactionId.dequeue().toString())
extraHeaders.forEach { (key, value) -> append(key, value) }
}
}
}

0 comments on commit 0fae1eb

Please sign in to comment.