From a7b23ece5c566948488c9d525df6a87c186e5728 Mon Sep 17 00:00:00 2001 From: Lamberto Basti Date: Thu, 23 May 2024 16:38:52 +0200 Subject: [PATCH] Add UserAgent to Ktor client and remove GITHUB_REF from run settings (#176) The commit introduces a new UserAgent to the Ktor client within the PackageSearchApplicationCachesService.kt for the IntelliJApplication. The UserAgent is set using fullApplicationName coming from the service ApplicationInfo. On a different note, an unused environment variable GITHUB_REF has been removed from the Plugin.run.xml configuration file, for cleanup purposes. --- .run/[KMP] Package Search Plugin.run.xml | 1 - .../plugin/services/PackageSearchApplicationCachesService.kt | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.run/[KMP] Package Search Plugin.run.xml b/.run/[KMP] Package Search Plugin.run.xml index d31f4c3e..246431b0 100644 --- a/.run/[KMP] Package Search Plugin.run.xml +++ b/.run/[KMP] Package Search Plugin.run.xml @@ -4,7 +4,6 @@ diff --git a/plugin/src/main/kotlin/com/jetbrains/packagesearch/plugin/services/PackageSearchApplicationCachesService.kt b/plugin/src/main/kotlin/com/jetbrains/packagesearch/plugin/services/PackageSearchApplicationCachesService.kt index ef7fe1d3..709a19d5 100644 --- a/plugin/src/main/kotlin/com/jetbrains/packagesearch/plugin/services/PackageSearchApplicationCachesService.kt +++ b/plugin/src/main/kotlin/com/jetbrains/packagesearch/plugin/services/PackageSearchApplicationCachesService.kt @@ -24,6 +24,7 @@ import com.jetbrains.packagesearch.plugin.utils.PackageSearchLogger import com.jetbrains.packagesearch.plugin.utils.PackageSearchProjectService import io.ktor.client.engine.java.Java import io.ktor.client.plugins.DefaultRequest +import io.ktor.client.plugins.UserAgent import io.ktor.client.plugins.logging.LogLevel import io.ktor.client.plugins.logging.Logging import io.ktor.client.request.headers @@ -98,6 +99,9 @@ class PackageSearchApplicationCachesService(private val coroutineScope: Coroutin append("JB-IDE-Version", IntelliJApplication.service().strictVersion) } } + install(UserAgent) { + agent = IntelliJApplication.service().fullApplicationName + } } )