Skip to content

Commit

Permalink
Add x-goog-api-client header (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlazo authored Dec 13, 2023
1 parent 36eac4f commit f285dc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions generativeai/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ android {
namespace = "com.google.ai.client.generativeai"
compileSdk = 34

buildFeatures.buildConfig = true

defaultConfig {
minSdk = 21

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")

buildConfigField("String", "VERSION_NAME", "\"${project.version.toString()}\"")
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.ai.client.generativeai.internal.api

import com.google.ai.client.generativeai.BuildConfig
import com.google.ai.client.generativeai.internal.util.decodeToFlow
import com.google.ai.client.generativeai.type.ServerException
import io.ktor.client.HttpClient
Expand Down Expand Up @@ -101,6 +102,7 @@ internal class APIController(
}
contentType(ContentType.Application.Json)
header("x-goog-api-key", key)
header("x-goog-api-client", "genai-android/${BuildConfig.VERSION_NAME}")
}
}

Expand Down

0 comments on commit f285dc1

Please sign in to comment.