diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index b1077fbd..0fc31131 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 704c883b..0ad17cbd 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,7 +1,7 @@ - + diff --git a/forage-android/src/main/java/com/joinforage/forage/android/network/OkHttpClientBuilder.kt b/forage-android/src/main/java/com/joinforage/forage/android/network/OkHttpClientBuilder.kt index 4144309c..a73c7fdd 100644 --- a/forage-android/src/main/java/com/joinforage/forage/android/network/OkHttpClientBuilder.kt +++ b/forage-android/src/main/java/com/joinforage/forage/android/network/OkHttpClientBuilder.kt @@ -18,7 +18,19 @@ internal object OkHttpClientBuilder { .addHeader( ForageConstants.Headers.AUTHORIZATION, "${ForageConstants.Headers.BEARER} $sessionToken" - ).run { + ) + .run { + // If the API_VERSION header has already been appended, don't override it! + chain.request().headers[ForageConstants.Headers.API_VERSION]?.let { + this + } + // Otherwise, set the default API_VERSION header + ?: addHeader( + ForageConstants.Headers.API_VERSION, + "default" + ) + } + .run { merchantId?.let { addHeader( ForageConstants.Headers.MERCHANT_ACCOUNT, diff --git a/forage-android/src/main/java/com/joinforage/forage/android/vault/AbstractVaultSubmitter.kt b/forage-android/src/main/java/com/joinforage/forage/android/vault/AbstractVaultSubmitter.kt index 383dcdc5..0dcdde3c 100644 --- a/forage-android/src/main/java/com/joinforage/forage/android/vault/AbstractVaultSubmitter.kt +++ b/forage-android/src/main/java/com/joinforage/forage/android/vault/AbstractVaultSubmitter.kt @@ -131,6 +131,7 @@ internal abstract class AbstractVaultSubmitter( .setHeader(ForageConstants.Headers.MERCHANT_ACCOUNT, params.merchantId) .setHeader(ForageConstants.Headers.IDEMPOTENCY_KEY, params.idempotencyKey) .setHeader(ForageConstants.Headers.TRACE_ID, logger.getTraceIdValue()) + .setHeader(ForageConstants.Headers.API_VERSION, "default") .setToken(vaultToken) // PaymentMethod.card.token is in the comma-separated format ,,